aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikhnenko <mikhnenko@yandex-team.com>2023-10-17 19:20:32 +0300
committermikhnenko <mikhnenko@yandex-team.com>2023-10-17 20:03:07 +0300
commit679d3abe25cfc5fc1a8a781a18add27e8a0ee677 (patch)
tree4e71eb2a49c2d53517f898d318a7e1c66df10e11
parentcc1f2e5275032108b1e7e7410b858797b6c44ac8 (diff)
downloadydb-679d3abe25cfc5fc1a8a781a18add27e8a0ee677.tar.gz
Upd libc++ to 18 May f0e61029506fd63bb300f2dbbd65ba792e4ef3a2
[libc++][P0943] Add stdatomic.h header. [libc++] Implement ranges::is_partitioned [libcxx] Reject month 0 in get_date/__get_month [libc++] Mark tests that use check_assertion.h as requiring unix headers [libcxx] [ci] Add a i386 Windows configuration to CI [libcxx] [test] Narrow down an XFAIL for clang-cl configurations [libcxx] [test] Extend the UNSUPPORTED lines in strong_order_long_dou… [libcxx] [test] Fix max_size.pass.cpp for other Windows architectures [libc++] Avoid a Microsoft SAL macro. [libc++] Add a few _LIBCPP_ASSERTs in __tree [libc++] Implement ranges::for_each{, _n} [libc++] Refactor max_size.pass.cpp [runtimes] Fix how we trigger CI [libc++] Overhaul how we select the ABI library [runtimes] [cmake] Fix -Werror detection in common build configs [libc++] Mark <stdatomic.h> as requiring C++23 [libcxx] Switch __cxx_contention_t to int32_t on 32 bit AIX [libc++] Remove __invalidate_all_iterators and replace the uses with … [libc++] Add a few more debug wrapper functions [libc++][ranges] Implement views::drop. [libcxx] [test] Fix the nasty_macros test on Windows on ARM/ARM64 [libcxx] Remove static inline and make use of _LIBCPP_HIDE_FROM_ABI i… [libcxx] random_device, use arc4random() on Solaris [libc++][ranges] Implement views::single. [libc++][ranges] Implement views::take. [libc++] Improve std::to_chars for base != 10. [lib++][doc] Fixes a link in the status paper. [libc++] Simplify the string structures a bit more [libc++][test] Verify std::views::drop and std::views::join are CPOs [runtimes] Introduce object libraries [libc++] Remove the legacy LIBCXX_LIBCPPABI_VERSION option [libc++] Remove overly conservative error in <stdatomic.h> [libc++] Introduce LIBCXX_LIBRARY_VERSION [libcxx] [test] Add missing header for std::numeric_limits [libcxx] [test] Include header for strverscmp [runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows [libc++][format] Adds a formattable concept. [libc++][format] Adds formatter<charT[N], charT>.
-rw-r--r--build/sysincl/stl-to-libcxx.yml6
-rw-r--r--build/ymake.core.conf2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h78
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h66
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h81
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__config2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__debug31
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/concepts.h53
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/format_fwd.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h12
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h11
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__fwd/span.h37
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__fwd/string_view.h37
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__hash_table16
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h43
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/next.h10
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h182
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h96
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h24
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h5
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h154
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h53
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h31
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h55
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__tree29
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/algorithm30
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/atomic6
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/charconv202
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/format1
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/list21
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/locale2
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/span4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/string73
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/string_view14
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/unordered_map16
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/unordered_set16
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/vector62
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/version2
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp2
-rw-r--r--contrib/libs/cxxsupp/libcxx/ya.make8
45 files changed, 1229 insertions, 364 deletions
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml
index ead3323484..47661b9782 100644
--- a/build/sysincl/stl-to-libcxx.yml
+++ b/build/sysincl/stl-to-libcxx.yml
@@ -257,6 +257,9 @@
- __algorithm/ranges_find.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h
- __algorithm/ranges_find_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h
- __algorithm/ranges_find_if_not.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h
+ - __algorithm/ranges_for_each.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h
+ - __algorithm/ranges_for_each_n.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
+ - __algorithm/ranges_is_partitioned.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h
- __algorithm/ranges_max.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h
- __algorithm/ranges_max_element.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h
- __algorithm/ranges_min.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h
@@ -356,6 +359,7 @@
- __concepts/swappable.h: contrib/libs/cxxsupp/libcxx/include/__concepts/swappable.h
- __concepts/totally_ordered.h: contrib/libs/cxxsupp/libcxx/include/__concepts/totally_ordered.h
- __filesystem/file_time_type.h: contrib/libs/cxxsupp/libcxx/include/__filesystem/file_time_type.h
+ - __format/concepts.h: contrib/libs/cxxsupp/libcxx/include/__format/concepts.h
- __format/enable_insertable.h: contrib/libs/cxxsupp/libcxx/include/__format/enable_insertable.h
- __functional/binary_function.h: contrib/libs/cxxsupp/libcxx/include/__functional/binary_function.h
- __functional/binary_negate.h: contrib/libs/cxxsupp/libcxx/include/__functional/binary_negate.h
@@ -383,6 +387,8 @@
- __functional/unary_negate.h: contrib/libs/cxxsupp/libcxx/include/__functional/unary_negate.h
- __functional/unwrap_ref.h: contrib/libs/cxxsupp/libcxx/include/__functional/unwrap_ref.h
- __functional/weak_result_type.h: contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h
+ - __fwd/span.h: contrib/libs/cxxsupp/libcxx/include/__fwd/span.h
+ - __fwd/string_view.h: contrib/libs/cxxsupp/libcxx/include/__fwd/string_view.h
- __ios/fpos.h: contrib/libs/cxxsupp/libcxx/include/__ios/fpos.h
- __iterator/access.h: contrib/libs/cxxsupp/libcxx/include/__iterator/access.h
- __iterator/advance.h: contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index ff5c5b1053..d7d100bc4e 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -9,7 +9,7 @@
FAKEID=628318530716
SANDBOX_FAKEID=${FAKEID}.7600000
-CPP_FAKEID=2023-10-09
+CPP_FAKEID=2023-10-17
GO_FAKEID=11100371
ANDROID_FAKEID=2023-05-17
CLANG_TIDY_FAKEID=2023-06-06
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h
new file mode 100644
index 0000000000..f284c0ee3a
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// 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___ALGORITHM_RANGES_FOR_EACH_H
+#define _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H
+
+#include <__algorithm/in_fun_result.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _Iter, class _Func>
+using for_each_result = in_fun_result<_Iter, _Func>;
+
+namespace __for_each {
+struct __fn {
+private:
+ template <class _Iter, class _Sent, class _Proj, class _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr static
+ for_each_result<_Iter, _Func> __for_each_impl(_Iter __first, _Sent __last, _Func& __func, _Proj& __proj) {
+ for (; __first != __last; ++__first)
+ std::invoke(__func, std::invoke(__proj, *__first));
+ return {std::move(__first), std::move(__func)};
+ }
+
+public:
+ template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ for_each_result<_Iter, _Func> operator()(_Iter __first, _Sent __last, _Func __func, _Proj __proj = {}) const {
+ return __for_each_impl(std::move(__first), std::move(__last), __func, __proj);
+ }
+
+ template <input_range _Range,
+ class _Proj = identity,
+ indirectly_unary_invocable<projected<iterator_t<_Range>, _Proj>> _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ for_each_result<borrowed_iterator_t<_Range>, _Func> operator()(_Range&& __range,
+ _Func __func,
+ _Proj __proj = {}) const {
+ return __for_each_impl(ranges::begin(__range), ranges::end(__range), __func, __proj);
+ }
+
+};
+} // namespace __for_each
+
+inline namespace __cpo {
+ inline constexpr auto for_each = __for_each::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
new file mode 100644
index 0000000000..f40f849a00
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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___ALGORITHM_RANGES_FOR_EACH_N_H
+#define _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H
+
+#include <__algorithm/in_fun_result.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/incrementable_traits.h>
+#include <__iterator/projected.h>
+#include <__ranges/concepts.h>
+#include <__ranges/dangling.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+
+template <class _Iter, class _Func>
+using for_each_n_result = in_fun_result<_Iter, _Func>;
+
+namespace __for_each_n {
+struct __fn {
+
+ template <input_iterator _Iter,
+ class _Proj = identity,
+ indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ for_each_n_result<_Iter, _Func> operator()(_Iter __first,
+ iter_difference_t<_Iter> __count,
+ _Func __func,
+ _Proj __proj = {}) const {
+ while (__count-- > 0) {
+ std::invoke(__func, std::invoke(__proj, *__first));
+ ++__first;
+ }
+ return {std::move(__first), std::move(__func)};
+ }
+
+};
+} // namespace __for_each_n
+
+inline namespace __cpo {
+ inline constexpr auto for_each_n = __for_each_n::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h
new file mode 100644
index 0000000000..3d572895eb
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// 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___ALGORITHM_RANGES_IS_PARTITIONED_H
+#define _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H
+
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __is_partitioned {
+struct __fn {
+
+ template <class _Iter, class _Sent, class _Proj, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr static
+ bool __is_parititioned_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ for (; __first != __last; ++__first) {
+ if (!std::invoke(__pred, std::invoke(__proj, *__first)))
+ break;
+ }
+
+ if (__first == __last)
+ return true;
+ ++__first;
+
+ for (; __first != __last; ++__first) {
+ if (std::invoke(__pred, std::invoke(__proj, *__first)))
+ return false;
+ }
+
+ return true;
+ }
+
+ template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ return __is_parititioned_impl(std::move(__first), std::move(__last), __pred, __proj);
+ }
+
+ template <input_range _Range,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr
+ bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ return __is_parititioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
+ }
+};
+} // namespace __is_partitioned
+
+inline namespace __cpo {
+ inline constexpr auto is_partitioned = __is_partitioned::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
+
+#endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h
index ed0a95d6e4..023f031e7e 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/arithmetic.h
@@ -39,8 +39,6 @@ concept floating_point = is_floating_point_v<_Tp>;
template <class _Tp>
concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
template <class _Tp>
-concept __libcpp_not_integral = !is_integral_v<_Tp>;
-template <class _Tp>
concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
#endif // _LIBCPP_STD_VER > 17
diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config
index bea1b6a0b9..3e1a53e6e6 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__config
+++ b/contrib/libs/cxxsupp/libcxx/include/__config
@@ -368,7 +368,7 @@
// When this option is used, the token passed to `std::random_device`'s
// constructor *must* be "/dev/urandom" -- anything else is an error.
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
- defined(__OpenBSD__) || defined(__DragonFly__)
+ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
# define _LIBCPP_USING_ARC4_RANDOM
#elif defined(__wasi__)
# define _LIBCPP_USING_GETENTROPY
diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug b/contrib/libs/cxxsupp/libcxx/include/__debug
index 1296b4db5b..39539af0e9 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__debug
+++ b/contrib/libs/cxxsupp/libcxx/include/__debug
@@ -226,6 +226,37 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser
#endif
}
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) {
+#if _LIBCPP_DEBUG_LEVEL == 2
+ if (!__libcpp_is_constant_evaluated())
+ __get_db()->__erase_c(__c);
+#else
+ (void)(__c);
+#endif
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) {
+#if _LIBCPP_DEBUG_LEVEL == 2
+ if (!__libcpp_is_constant_evaluated())
+ __get_db()->swap(__lhs, __rhs);
+#else
+ (void)(__lhs);
+ (void)(__rhs);
+#endif
+}
+
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) {
+#if _LIBCPP_DEBUG_LEVEL == 2
+ if (!__libcpp_is_constant_evaluated())
+ __get_db()->__invalidate_all(__c);
+#else
+ (void)(__c);
+#endif
+}
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___DEBUG
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h
new file mode 100644
index 0000000000..8df6493b0a
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/concepts.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___FORMAT_CONCEPTS_H
+#define _LIBCPP___FORMAT_CONCEPTS_H
+
+#include <__concepts/same_as.h>
+#include <__concepts/semiregular.h>
+#include <__config>
+#include <__format/format_fwd.h>
+#include <__format/format_parse_context.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17
+
+// The output iterator isn't specified. A formatter should accept any
+// output_iterator. This iterator is a minimal iterator to test the concept.
+// (Note testing for (w)format_context would be a valid choice, but requires
+// selecting the proper one depending on the type of _CharT.)
+template <class _CharT>
+using __fmt_iter_for = _CharT*;
+
+// The concept is based on P2286R6
+// It lacks the const of __cf as required by, the not yet accepted, LWG-3636.
+// The current formatters can't be easily adapted, but that is WIP.
+// TODO FMT properly implement this concepts once accepted.
+template <class _Tp, class _CharT>
+concept __formattable = (semiregular<formatter<remove_cvref_t<_Tp>, _CharT>>) &&
+ requires(formatter<remove_cvref_t<_Tp>, _CharT> __f,
+ formatter<remove_cvref_t<_Tp>, _CharT> __cf, _Tp __t,
+ basic_format_context<__fmt_iter_for<_CharT>, _CharT> __fc,
+ basic_format_parse_context<_CharT> __pc) {
+ { __f.parse(__pc) } -> same_as<typename basic_format_parse_context<_CharT>::iterator>;
+ { __cf.format(__t, __fc) } -> same_as<__fmt_iter_for<_CharT>>;
+ };
+
+#endif //_LIBCPP_STD_VER > 17
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FORMAT_CONCEPTS_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h
index 845a20f3c7..45356b22cd 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h
@@ -244,7 +244,7 @@ private:
requires is_void_v<_Tp> _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(_Tp* __p) noexcept
: __ptr(__p), __type_(__format::__arg_t::__ptr) {}
- template <__libcpp_not_integral _Tp>
+ template <class _Tp>
_LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const _Tp& __v) noexcept
: __handle(__v), __type_(__format::__arg_t::__handle) {}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_fwd.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_fwd.h
index 0f2e9085f8..908d10dbc3 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/format_fwd.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_fwd.h
@@ -12,6 +12,7 @@
#include <__availability>
#include <__config>
+#include <__iterator/concepts.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -27,6 +28,10 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_arg;
template <class _Context, class... _Args>
struct _LIBCPP_TEMPLATE_VIS __format_arg_store;
+template <class _OutIt, class _CharT>
+ requires output_iterator<_OutIt, const _CharT&>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_context;
+
template <class _Tp, class _CharT = char>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
index e78b43b8ca..c687e3fd48 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h
@@ -101,6 +101,18 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
}
};
+// Formatter char[].
+template <__formatter::__char_type _CharT, size_t _Size>
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT[_Size], _CharT>
+ : public __format_spec::__formatter_string<_CharT> {
+ static_assert(!is_const_v<_CharT>);
+ using _Base = __format_spec::__formatter_string<_CharT>;
+
+ _LIBCPP_HIDE_FROM_ABI auto format(_CharT __str[_Size], auto& __ctx) -> decltype(__ctx.out()) {
+ return _Base::format(basic_string_view<_CharT>(__str, _Size), __ctx);
+ }
+};
+
// Formatter const char[].
template <__formatter::__char_type _CharT, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h
index d64981aa9e..f0a6e49875 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h
@@ -31,12 +31,11 @@ struct __bind_back_op;
template <size_t _NBound, size_t ..._Ip>
struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
- template <class _Fn, class _Bound, class ..._Args>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Fn&& __f, _Bound&& __bound, _Args&& ...__args) const
- noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...)))
- -> decltype( _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...))
- { return _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_Bound>(__bound))...); }
+ template <class _Fn, class _BoundArgs, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
+ noexcept(noexcept(_VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...)))
+ -> decltype( _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...))
+ { return _VSTD::invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)..., _VSTD::get<_Ip>(_VSTD::forward<_BoundArgs>(__bound_args))...); }
};
template <class _Fn, class _BoundArgs>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h
new file mode 100644
index 0000000000..f38b8cfa05
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h
@@ -0,0 +1,37 @@
+// -*- 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_FWD_SPAN_H
+#define _LIBCPP_FWD_SPAN_H
+
+#include <__config>
+#include <cstddef>
+#include <limits>
+
+#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
+
+inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
+template <typename _Tp, size_t _Extent = dynamic_extent> class span;
+
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP_FWD_SPAN_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/string_view.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/string_view.h
new file mode 100644
index 0000000000..e5e77b292a
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/string_view.h
@@ -0,0 +1,37 @@
+// -*- 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_FWD_STRING_VIEW_H
+#define _LIBCPP_FWD_STRING_VIEW_H
+
+#include <__config>
+#include <iosfwd> // char_traits
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template<class _CharT, class _Traits = char_traits<_CharT> >
+class _LIBCPP_TEMPLATE_VIS basic_string_view;
+
+typedef basic_string_view<char> string_view;
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
+typedef basic_string_view<char8_t> u8string_view;
+#endif
+typedef basic_string_view<char16_t> u16string_view;
+typedef basic_string_view<char32_t> u32string_view;
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+typedef basic_string_view<wchar_t> wstring_view;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_FWD_STRING_VIEW_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table
index 605f13c360..14f53429de 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__hash_table
+++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table
@@ -1519,9 +1519,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
#endif
__deallocate_node(__p1_.first().__next_);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__erase_c(this);
-#endif
+ std::__debug_db_erase_c(this);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -1624,9 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -2328,9 +2324,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
+ std::__debug_db_invalidate_all(this);
__pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
__bucket_list_.reset(__nbc > 0 ?
__pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
@@ -2736,9 +2730,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
if (__u.size() > 0)
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
__u.__p1_.first().__ptr();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
index 9a74f1421c..28f09773a2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h
@@ -117,47 +117,46 @@ public:
}
}
- // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound) denotes a range.
+ // Preconditions: Either `assignable_from<I&, S> || sized_sentinel_for<S, I>` is modeled, or [i, bound_sentinel) denotes a range.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr void operator()(_Ip& __i, _Sp ___bound) const {
- // If `I` and `S` model `assignable_from<I&, S>`, equivalent to `i = std::move(bound)`.
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, _Sp ___bound_sentinel) const {
+ // If `I` and `S` model `assignable_from<I&, S>`, equivalent to `i = std::move(bound_sentinel)`.
if constexpr (assignable_from<_Ip&, _Sp>) {
- __i = _VSTD::move(___bound);
+ __i = _VSTD::move(___bound_sentinel);
}
- // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound - i)`.
+ // Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent to `ranges::advance(i, bound_sentinel - i)`.
else if constexpr (sized_sentinel_for<_Sp, _Ip>) {
- (*this)(__i, ___bound - __i);
+ (*this)(__i, ___bound_sentinel - __i);
}
- // Otherwise, while `bool(i != bound)` is true, increments `i`.
+ // Otherwise, while `bool(i != bound_sentinel)` is true, increments `i`.
else {
- while (__i != ___bound) {
+ while (__i != ___bound_sentinel) {
++__i;
}
}
}
// Preconditions:
- // * If `n > 0`, [i, bound) denotes a range.
- // * If `n == 0`, [i, bound) or [bound, i) denotes a range.
- // * If `n < 0`, [bound, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model `same_as<I, S>`.
- // Returns: `n - M`, where `M` is the difference between the the ending and starting position.
+ // * If `n > 0`, [i, bound_sentinel) denotes a range.
+ // * If `n == 0`, [i, bound_sentinel) or [bound_sentinel, i) denotes a range.
+ // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model `same_as<I, S>`.
+ // Returns: `n - M`, where `M` is the difference between the ending and starting position.
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp ___bound) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n,
+ _Sp ___bound_sentinel) const {
_LIBCPP_ASSERT((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
"If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
if constexpr (sized_sentinel_for<_Sp, _Ip>) {
- // If |n| >= |bound - i|, equivalent to `ranges::advance(i, bound)`.
+ // If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`.
// __magnitude_geq(a, b) returns |a| >= |b|, assuming they have the same sign.
auto __magnitude_geq = [](auto __a, auto __b) {
return __a == 0 ? __b == 0 :
__a > 0 ? __a >= __b :
__a <= __b;
};
- if (const auto __M = ___bound - __i; __magnitude_geq(__n, __M)) {
- (*this)(__i, ___bound);
+ if (const auto __M = ___bound_sentinel - __i; __magnitude_geq(__n, __M)) {
+ (*this)(__i, ___bound_sentinel);
return __n - __M;
}
@@ -165,16 +164,16 @@ public:
(*this)(__i, __n);
return 0;
} else {
- // Otherwise, if `n` is non-negative, while `bool(i != bound)` is true, increments `i` but at
+ // Otherwise, if `n` is non-negative, while `bool(i != bound_sentinel)` is true, increments `i` but at
// most `n` times.
- while (__i != ___bound && __n > 0) {
+ while (__i != ___bound_sentinel && __n > 0) {
++__i;
--__n;
}
- // Otherwise, while `bool(i != bound)` is true, decrements `i` but at most `-n` times.
+ // Otherwise, while `bool(i != bound_sentinel)` is true, decrements `i` but at most `-n` times.
if constexpr (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>) {
- while (__i != ___bound && __n < 0) {
+ while (__i != ___bound_sentinel && __n < 0) {
--__i;
++__n;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h
index 7939840b6d..0d48165168 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h
@@ -58,16 +58,14 @@ struct __fn {
}
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, _Sp ___bound) const {
- ranges::advance(__x, ___bound);
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, _Sp ___bound_sentinel) const {
+ ranges::advance(__x, ___bound_sentinel);
return __x;
}
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp ___bound) const {
- ranges::advance(__x, __n, ___bound);
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp ___bound_sentinel) const {
+ ranges::advance(__x, __n, ___bound_sentinel);
return __x;
}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h
index e68b8759b7..42d176ff65 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h
@@ -57,9 +57,8 @@ struct __fn {
}
template <bidirectional_iterator _Ip>
- _LIBCPP_HIDE_FROM_ABI
- constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Ip ___bound) const {
- ranges::advance(__x, -__n, ___bound);
+ _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Ip ___bound_iter) const {
+ ranges::advance(__x, -__n, ___bound_iter);
return __x;
}
};
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h
index 93f4b9f188..962bc4e900 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/drop_view.h
@@ -9,18 +9,29 @@
#ifndef _LIBCPP___RANGES_DROP_VIEW_H
#define _LIBCPP___RANGES_DROP_VIEW_H
+#include <__algorithm/min.h>
#include <__assert>
#include <__config>
+#include <__functional/bind_back.h>
+#include <__fwd/span.h>
+#include <__fwd/string_view.h>
#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
#include <__ranges/access.h>
#include <__ranges/all.h>
#include <__ranges/concepts.h>
+#include <__ranges/empty_view.h>
#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/iota_view.h>
#include <__ranges/non_propagating_cache.h>
+#include <__ranges/range_adaptor.h>
#include <__ranges/size.h>
+#include <__ranges/subrange.h>
#include <__ranges/view_interface.h>
+#include <__utility/auto_cast.h>
+#include <__utility/forward.h>
#include <__utility/move.h>
#include <concepts>
#include <type_traits>
@@ -113,11 +124,174 @@ public:
{ return __size(*this); }
};
- template<class _Range>
- drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
+template<class _Range>
+drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
+
+template<class _Tp>
+inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
+
+namespace views {
+namespace __drop {
+
+template <class _Tp>
+inline constexpr bool __is_empty_view = false;
+
+template <class _Tp>
+inline constexpr bool __is_empty_view<empty_view<_Tp>> = true;
+
+template <class _Tp>
+inline constexpr bool __is_passthrough_specialization = false;
+
+template <class _Tp, size_t _Extent>
+inline constexpr bool __is_passthrough_specialization<span<_Tp, _Extent>> = true;
+
+template <class _CharT, class _Traits>
+inline constexpr bool __is_passthrough_specialization<basic_string_view<_CharT, _Traits>> = true;
+
+template <class _Np, class _Bound>
+inline constexpr bool __is_passthrough_specialization<iota_view<_Np, _Bound>> = true;
+
+template <class _Iter, class _Sent, subrange_kind _Kind>
+inline constexpr bool __is_passthrough_specialization<subrange<_Iter, _Sent, _Kind>> =
+ !subrange<_Iter, _Sent, _Kind>::_StoreSize;
+
+template <class _Tp>
+inline constexpr bool __is_subrange_specialization_with_store_size = false;
+
+template <class _Iter, class _Sent, subrange_kind _Kind>
+inline constexpr bool __is_subrange_specialization_with_store_size<subrange<_Iter, _Sent, _Kind>> =
+ subrange<_Iter, _Sent, _Kind>::_StoreSize;
+
+template <class _Tp>
+struct __passthrough_type;
+
+template <class _Tp, size_t _Extent>
+struct __passthrough_type<span<_Tp, _Extent>> {
+ using type = span<_Tp>;
+};
+
+template <class _CharT, class _Traits>
+struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
+ using type = basic_string_view<_CharT, _Traits>;
+};
+
+template <class _Np, class _Bound>
+struct __passthrough_type<iota_view<_Np, _Bound>> {
+ using type = iota_view<_Np, _Bound>;
+};
+
+template <class _Iter, class _Sent, subrange_kind _Kind>
+struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
+ using type = subrange<_Iter, _Sent, _Kind>;
+};
+
+template <class _Tp>
+using __passthrough_type_t = typename __passthrough_type<_Tp>::type;
+
+struct __fn {
+ // [range.drop.overview]: the `empty_view` case.
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
+ requires __is_empty_view<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
+ { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+
+ // [range.drop.overview]: the `span | basic_string_view | iota_view | subrange (StoreSize == false)` case.
+ template <class _Range,
+ convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>,
+ class _Dist = range_difference_t<_Range>>
+ requires (!__is_empty_view<_RawRange> &&
+ random_access_range<_RawRange> &&
+ sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng)
+ )))
+ -> decltype( __passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng)
+ ))
+ { return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng)
+ ); }
+
+ // [range.drop.overview]: the `subrange (StoreSize == true)` case.
+ template <class _Range,
+ convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>,
+ class _Dist = range_difference_t<_Range>>
+ requires (!__is_empty_view<_RawRange> &&
+ random_access_range<_RawRange> &&
+ sized_range<_RawRange> &&
+ __is_subrange_specialization_with_store_size<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(_RawRange(
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
+ )))
+ -> decltype( _RawRange(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
+ ranges::end(__rng),
+ std::__to_unsigned_like(ranges::distance(__rng) -
+ std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
+ ))
+ {
+ // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
+ // expression used in the `noexcept` clause and the return statement).
+ auto dist = ranges::distance(__rng);
+ auto clamped = std::min<_Dist>(dist, std::forward<_Np>(__n));
+ return _RawRange(
+ ranges::begin(__rng) + clamped,
+ ranges::end(__rng),
+ std::__to_unsigned_like(dist - clamped)
+ );}
+
+ // [range.drop.overview]: the "otherwise" case.
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires (!(__is_empty_view<_RawRange> ||
+ (__is_subrange_specialization_with_store_size<_RawRange> &&
+ sized_range<_RawRange> &&
+ random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> &&
+ sized_range<_RawRange> &&
+ random_access_range<_RawRange>)
+ ))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype( drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
+ { return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+
+ template <class _Np>
+ requires constructible_from<decay_t<_Np>, _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
+ { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+};
+
+} // namespace __drop
+
+inline namespace __cpo {
+ inline constexpr auto drop = __drop::__fn{};
+} // namespace __cpo
+} // namespace views
- template<class _Tp>
- inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
} // namespace ranges
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h
index 62e98d475b..e1f03bafa0 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h
@@ -90,9 +90,9 @@ namespace ranges {
using iterator_category = input_iterator_tag;
};
- template<weakly_incrementable _Start, semiregular _Bound = unreachable_sentinel_t>
- requires __weakly_equality_comparable_with<_Start, _Bound> && copyable<_Start>
- class iota_view : public view_interface<iota_view<_Start, _Bound>> {
+ template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
+ requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
+ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
struct __iterator : public __iota_iterator_category<_Start> {
friend class iota_view;
@@ -271,35 +271,35 @@ namespace ranges {
friend class iota_view;
private:
- _Bound __bound_ = _Bound();
+ _BoundSentinel __bound_sentinel_ = _BoundSentinel();
public:
_LIBCPP_HIDE_FROM_ABI
__sentinel() = default;
- constexpr explicit __sentinel(_Bound __bound) : __bound_(std::move(__bound)) {}
+ constexpr explicit __sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {}
_LIBCPP_HIDE_FROM_ABI
friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __x.__value_ == __y.__bound_;
+ return __x.__value_ == __y.__bound_sentinel_;
}
_LIBCPP_HIDE_FROM_ABI
friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y)
- requires sized_sentinel_for<_Bound, _Start>
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
- return __x.__value_ - __y.__bound_;
+ return __x.__value_ - __y.__bound_sentinel_;
}
_LIBCPP_HIDE_FROM_ABI
friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y)
- requires sized_sentinel_for<_Bound, _Start>
+ requires sized_sentinel_for<_BoundSentinel, _Start>
{
return -(__y - __x);
}
};
_Start __value_ = _Start();
- _Bound __bound_ = _Bound();
+ _BoundSentinel __bound_sentinel_ = _BoundSentinel();
public:
_LIBCPP_HIDE_FROM_ABI
@@ -309,75 +309,76 @@ namespace ranges {
constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { }
_LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_Bound> __bound)
- : __value_(std::move(__value)), __bound_(std::move(__bound)) {
+ constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
+ : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
// Validate the precondition if possible.
- if constexpr (totally_ordered_with<_Start, _Bound>) {
- _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_),
+ if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
+ _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_sentinel_),
"Precondition violated: value is greater than bound.");
}
}
_LIBCPP_HIDE_FROM_ABI
constexpr iota_view(__iterator __first, __iterator __last)
- requires same_as<_Start, _Bound>
- : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
+ requires same_as<_Start, _BoundSentinel>
+ : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
_LIBCPP_HIDE_FROM_ABI
- constexpr iota_view(__iterator __first, _Bound __last)
- requires same_as<_Bound, unreachable_sentinel_t>
- : iota_view(std::move(__first.__value_), std::move(__last)) {}
+ constexpr iota_view(__iterator __first, _BoundSentinel __last)
+ requires same_as<_BoundSentinel, unreachable_sentinel_t>
+ : iota_view(std::move(__first.__value_), std::move(__last)) {}
_LIBCPP_HIDE_FROM_ABI
constexpr iota_view(__iterator __first, __sentinel __last)
- requires (!same_as<_Start, _Bound> && !same_as<_Start, unreachable_sentinel_t>)
- : iota_view(std::move(__first.__value_), std::move(__last.__bound_)) {}
+ requires(!same_as<_Start, _BoundSentinel> && !same_as<_Start, unreachable_sentinel_t>)
+ : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
_LIBCPP_HIDE_FROM_ABI
constexpr __iterator begin() const { return __iterator{__value_}; }
_LIBCPP_HIDE_FROM_ABI
constexpr auto end() const {
- if constexpr (same_as<_Bound, unreachable_sentinel_t>)
+ if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
return unreachable_sentinel;
else
- return __sentinel{__bound_};
+ return __sentinel{__bound_sentinel_};
}
_LIBCPP_HIDE_FROM_ABI
- constexpr __iterator end() const requires same_as<_Start, _Bound> {
- return __iterator{__bound_};
+ constexpr __iterator end() const
+ requires same_as<_Start, _BoundSentinel>
+ {
+ return __iterator{__bound_sentinel_};
}
_LIBCPP_HIDE_FROM_ABI
constexpr auto size() const
- requires (same_as<_Start, _Bound> && __advanceable<_Start>) ||
- (integral<_Start> && integral<_Bound>) ||
- sized_sentinel_for<_Bound, _Start>
+ requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
+ (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
{
- if constexpr (__integer_like<_Start> && __integer_like<_Bound>) {
+ if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
if (__value_ < 0) {
- if (__bound_ < 0) {
- return std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_);
+ if (__bound_sentinel_ < 0) {
+ return std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_);
}
- return std::__to_unsigned_like(__bound_) + std::__to_unsigned_like(-__value_);
+ return std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_);
}
- return std::__to_unsigned_like(__bound_) - std::__to_unsigned_like(__value_);
+ return std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
}
- return std::__to_unsigned_like(__bound_ - __value_);
+ return std::__to_unsigned_like(__bound_sentinel_ - __value_);
}
};
- template<class _Start, class _Bound>
- requires (!__integer_like<_Start> || !__integer_like<_Bound> ||
- (__signed_integer_like<_Start> == __signed_integer_like<_Bound>))
- iota_view(_Start, _Bound) -> iota_view<_Start, _Bound>;
+ template <class _Start, class _BoundSentinel>
+ requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
+ (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
+ iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
- template<class _Start, class _Bound>
- inline constexpr bool enable_borrowed_range<iota_view<_Start, _Bound>> = true;
+ template <class _Start, class _BoundSentinel>
+ inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
-namespace views {
-namespace __iota {
+ namespace views {
+ namespace __iota {
struct __fn {
template<class _Start>
_LIBCPP_HIDE_FROM_ABI
@@ -386,12 +387,11 @@ namespace __iota {
-> decltype( ranges::iota_view(std::forward<_Start>(__start)))
{ return ranges::iota_view(std::forward<_Start>(__start)); }
- template<class _Start, class _Bound>
- _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Start&& __start, _Bound&& __bound) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound))))
- -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)))
- { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_Bound>(__bound)); }
+ template <class _Start, class _BoundSentinel>
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const
+ noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
+ -> decltype( ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)))
+ { return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel)); }
};
} // namespace __iota
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h
index 68617c48f8..e559a76ef7 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/lazy_split_view.h
@@ -87,8 +87,7 @@ public:
_LIBCPP_HIDE_FROM_ABI
constexpr lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
: __base_(views::all(std::forward<_Range>(__r)))
- // TODO(varconst): use `views::single` once it's implemented.
- , __pattern_(ranges::single_view(std::move(__e))) {}
+ , __pattern_(views::single(std::move(__e))) {}
_LIBCPP_HIDE_FROM_ABI
constexpr _View base() const& requires copy_constructible<_View> { return __base_; }
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h
index e6a873058f..98ebe5f383 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__ranges/copyable_box.h>
+#include <__ranges/range_adaptor.h>
#include <__ranges/view_interface.h>
#include <__utility/forward.h>
#include <__utility/in_place.h>
@@ -70,8 +71,27 @@ namespace ranges {
constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
};
- template<class _Tp>
- single_view(_Tp) -> single_view<_Tp>;
+template<class _Tp>
+single_view(_Tp) -> single_view<_Tp>;
+
+namespace views {
+namespace __single_view {
+
+struct __fn : __range_adaptor_closure<__fn> {
+ template<class _Range>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __range) const
+ noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
+ -> decltype( single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)))
+ { return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range)); }
+};
+} // namespace __single_view
+
+inline namespace __cpo {
+ inline constexpr auto single = __single_view::__fn{};
+} // namespace __cpo
+
+} // namespace views
} // namespace ranges
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
index 24e5eff3f8..7e42da6ce7 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h
@@ -77,8 +77,11 @@ namespace ranges {
class _LIBCPP_TEMPLATE_VIS subrange
: public view_interface<subrange<_Iter, _Sent, _Kind>>
{
- private:
+ public:
+ // Note: this is an internal implementation detail that is public only for internal usage.
static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
+
+ private:
static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
struct _Empty { constexpr _Empty(auto) noexcept { } };
using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h
index 3ad7810a9c..11d5c9fc36 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/take_view.h
@@ -9,18 +9,29 @@
#ifndef _LIBCPP___RANGES_TAKE_VIEW_H
#define _LIBCPP___RANGES_TAKE_VIEW_H
+#include <__algorithm/min.h>
#include <__algorithm/ranges_min.h>
#include <__config>
+#include <__functional/bind_back.h>
+#include <__fwd/span.h>
+#include <__fwd/string_view.h>
#include <__iterator/concepts.h>
#include <__iterator/counted_iterator.h>
#include <__iterator/default_sentinel.h>
+#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>
#include <__ranges/all.h>
#include <__ranges/concepts.h>
+#include <__ranges/empty_view.h>
#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/iota_view.h>
+#include <__ranges/range_adaptor.h>
#include <__ranges/size.h>
+#include <__ranges/subrange.h>
#include <__ranges/view_interface.h>
+#include <__utility/auto_cast.h>
+#include <__utility/forward.h>
#include <__utility/move.h>
#include <concepts>
#include <type_traits>
@@ -115,7 +126,6 @@ public:
}
}
-
_LIBCPP_HIDE_FROM_ABI
constexpr auto size() requires sized_range<_View> {
auto __n = ranges::size(__base_);
@@ -174,6 +184,148 @@ take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range
template<class _Tp>
inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>;
+namespace views {
+namespace __take {
+
+template <class _Tp>
+inline constexpr bool __is_empty_view = false;
+
+template <class _Tp>
+inline constexpr bool __is_empty_view<empty_view<_Tp>> = true;
+
+template <class _Tp>
+inline constexpr bool __is_passthrough_specialization = false;
+
+template <class _Tp, size_t _Extent>
+inline constexpr bool __is_passthrough_specialization<span<_Tp, _Extent>> = true;
+
+template <class _CharT, class _Traits>
+inline constexpr bool __is_passthrough_specialization<basic_string_view<_CharT, _Traits>> = true;
+
+template <class _Iter, class _Sent, subrange_kind _Kind>
+inline constexpr bool __is_passthrough_specialization<subrange<_Iter, _Sent, _Kind>> = true;
+
+template <class _Tp>
+inline constexpr bool __is_iota_specialization = false;
+
+template <class _Np, class _Bound>
+inline constexpr bool __is_iota_specialization<iota_view<_Np, _Bound>> = true;
+
+template <class _Tp>
+struct __passthrough_type;
+
+template <class _Tp, size_t _Extent>
+struct __passthrough_type<span<_Tp, _Extent>> {
+ using type = span<_Tp>;
+};
+
+template <class _CharT, class _Traits>
+struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
+ using type = basic_string_view<_CharT, _Traits>;
+};
+
+template <class _Iter, class _Sent, subrange_kind _Kind>
+struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
+ using type = subrange<_Iter>;
+};
+
+template <class _Tp>
+using __passthrough_type_t = typename __passthrough_type<_Tp>::type;
+
+struct __fn {
+ // [range.take.overview]: the `empty_view` case.
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
+ requires __is_empty_view<remove_cvref_t<_Range>>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __range, _Np&&) const
+ noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
+ -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
+ { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
+
+ // [range.take.overview]: the `span | basic_string_view | subrange` case.
+ template <class _Range,
+ convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>,
+ class _Dist = range_difference_t<_Range>>
+ requires (!__is_empty_view<_RawRange> &&
+ random_access_range<_RawRange> &&
+ sized_range<_RawRange> &&
+ __is_passthrough_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(__passthrough_type_t<_RawRange>(
+ ranges::begin(__rng),
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ )))
+ -> decltype( __passthrough_type_t<_RawRange>(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ ranges::begin(__rng),
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ ))
+ { return __passthrough_type_t<_RawRange>(
+ ranges::begin(__rng),
+ ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ ); }
+
+ // [range.take.overview]: the `iota_view` case.
+ template <class _Range,
+ convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>,
+ class _Dist = range_difference_t<_Range>>
+ requires (!__is_empty_view<_RawRange> &&
+ random_access_range<_RawRange> &&
+ sized_range<_RawRange> &&
+ __is_iota_specialization<_RawRange>)
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __rng, _Np&& __n) const
+ noexcept(noexcept(ranges::iota_view(
+ *ranges::begin(__rng),
+ *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ )))
+ -> decltype( ranges::iota_view(
+ // Note: deliberately not forwarding `__rng` to guard against double moves.
+ *ranges::begin(__rng),
+ *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ ))
+ { return ranges::iota_view(
+ *ranges::begin(__rng),
+ *ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))
+ ); }
+
+ // [range.take.overview]: the "otherwise" case.
+ template <class _Range, convertible_to<range_difference_t<_Range>> _Np,
+ class _RawRange = remove_cvref_t<_Range>>
+ // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
+ // overloads.
+ requires (!(__is_empty_view<_RawRange> ||
+ (__is_iota_specialization<_RawRange> &&
+ sized_range<_RawRange> &&
+ random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> &&
+ sized_range<_RawRange> &&
+ random_access_range<_RawRange>)
+ ))
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Range&& __range, _Np&& __n) const
+ noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
+ -> decltype( take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)))
+ { return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n)); }
+
+ template <class _Np>
+ requires constructible_from<decay_t<_Np>, _Np>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
+ constexpr auto operator()(_Np&& __n) const
+ noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>)
+ { return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n))); }
+};
+
+} // namespace __take
+
+inline namespace __cpo {
+ inline constexpr auto take = __take::__fn{};
+} // namespace __cpo
+} // namespace views
+
} // namespace ranges
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
index 46e02a6c8b..2b2d927bae 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
@@ -12,7 +12,8 @@
#include <time.h>
-static inline int gettimeofdayMonotonic(struct timespec64* Output) {
+inline _LIBCPP_HIDE_FROM_ABI int
+gettimeofdayMonotonic(struct timespec64* Output) {
// The POSIX gettimeofday() function is not available on z/OS. Therefore,
// we will call stcke and other hardware instructions in implement equivalent.
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
index 15b8386dd3..11c1847e4c 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
@@ -52,57 +52,50 @@ private:
// The following are not POSIX routines. These are quick-and-dirty hacks
// to make things pretend to work
-static inline
-long long strtoll_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long long
+strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtoll(__nptr, __endptr, __base);
+ return ::strtoll(__nptr, __endptr, __base);
}
-static inline
-long strtol_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long
+strtol_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtol(__nptr, __endptr, __base);
+ return ::strtol(__nptr, __endptr, __base);
}
-static inline
-double strtod_l(const char *__nptr, char **__endptr,
- locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI double
+strtod_l(const char *__nptr, char **__endptr, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtod(__nptr, __endptr);
+ return ::strtod(__nptr, __endptr);
}
-static inline
-float strtof_l(const char *__nptr, char **__endptr,
- locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI float
+strtof_l(const char *__nptr, char **__endptr, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtof(__nptr, __endptr);
+ return ::strtof(__nptr, __endptr);
}
-static inline
-long double strtold_l(const char *__nptr, char **__endptr,
- locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long double
+strtold_l(const char *__nptr, char **__endptr, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtold(__nptr, __endptr);
+ return ::strtold(__nptr, __endptr);
}
-static inline
-unsigned long long strtoull_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI unsigned long long
+strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtoull(__nptr, __endptr, __base);
+ return ::strtoull(__nptr, __endptr, __base);
}
-static inline
-unsigned long strtoul_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI unsigned long
+strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
- return strtoul(__nptr, __endptr, __base);
+ return ::strtoul(__nptr, __endptr, __base);
}
-static inline
-int vasprintf(char **strp, const char *fmt, va_list ap) {
+inline _LIBCPP_HIDE_FROM_ABI int
+vasprintf(char **strp, const char *fmt, va_list ap) {
const size_t buff_size = 256;
if ((*strp = (char *)malloc(buff_size)) == NULL) {
return -1;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
index 2508a8e8e0..f85cd1cbf2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
@@ -24,30 +24,29 @@
extern "C" {
#endif
-static inline long long strtoll_l(const char *nptr, char **endptr, int base,
- locale_t) {
- return strtoll(nptr, endptr, base);
+inline _LIBCPP_HIDE_FROM_ABI long long
+strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
+ return ::strtoll(nptr, endptr, base);
}
-static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
- int base, locale_t) {
- return strtoull(nptr, endptr, base);
+inline _LIBCPP_HIDE_FROM_ABI unsigned long long
+strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
+ return ::strtoull(nptr, endptr, base);
}
-static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
- int base, locale_t) {
- return wcstoll(nptr, endptr, base);
+inline _LIBCPP_HIDE_FROM_ABI long long
+wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
+ return ::wcstoll(nptr, endptr, base);
}
-static inline unsigned long long wcstoull_l(const wchar_t *nptr,
- wchar_t **endptr, int base,
- locale_t) {
- return wcstoull(nptr, endptr, base);
+inline _LIBCPP_HIDE_FROM_ABI long long
+wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
+ return ::wcstoull(nptr, endptr, base);
}
-static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
- locale_t) {
- return wcstold(nptr, endptr);
+inline _LIBCPP_HIDE_FROM_ABI long double
+wcstold_l(const wchar_t *nptr, wchar_t **endptr, locale_t) {
+ return ::wcstold(nptr, endptr);
}
#ifdef __cplusplus
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
index 05131f0272..373fbfbd60 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
@@ -32,40 +32,39 @@ struct lconv *localeconv(void);
struct lconv *localeconv_l(locale_t __l);
// FIXME: These are quick-and-dirty hacks to make things pretend to work
-static inline
-long long strtoll_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoll(__nptr, __endptr, __base);
+inline _LIBCPP_HIDE_FROM_ABI long long
+strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
+ return ::strtoll(__nptr, __endptr, __base);
}
-static inline
-long strtol_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtol(__nptr, __endptr, __base);
+
+inline _LIBCPP_HIDE_FROM_ABI long
+strtol_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
+ return ::strtol(__nptr, __endptr, __base);
}
-static inline
-unsigned long long strtoull_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoull(__nptr, __endptr, __base);
+
+inline _LIBCPP_HIDE_FROM_ABI unsigned long long
+strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc)
+ return ::strtoull(__nptr, __endptr, __base);
}
-static inline
-unsigned long strtoul_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoul(__nptr, __endptr, __base);
+
+inline _LIBCPP_HIDE_FROM_ABI unsigned long
+strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
+ return ::strtoul(__nptr, __endptr, __base);
}
-static inline
-float strtof_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtof(__nptr, __endptr);
+
+inline _LIBCPP_HIDE_FROM_ABI float
+strtof_l(const char *__nptr, char **__endptr, locale_t __loc) {
+ return ::strtof(__nptr, __endptr);
}
-static inline
-double strtod_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtod(__nptr, __endptr);
+
+inline _LIBCPP_HIDE_FROM_ABI double
+strtod_l(const char *__nptr, char **__endptr, locale_t __loc) {
+ return ::strtod(__nptr, __endptr);
}
-static inline
-long double strtold_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtold(__nptr, __endptr);
+
+inline _LIBCPP_HIDE_FROM_ABI long double
+strtold_l(const char *__nptr, char **__endptr, locale_t __loc) {
+ return ::strtold(__nptr, __endptr);
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__tree b/contrib/libs/cxxsupp/libcxx/include/__tree
index f8d2226e66..c493ff9be0 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__tree
+++ b/contrib/libs/cxxsupp/libcxx/include/__tree
@@ -141,35 +141,35 @@ __tree_invariant(_NodePtr __root)
}
// Returns: pointer to the left-most node under __x.
-// Precondition: __x != nullptr.
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
_NodePtr
__tree_min(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "Root node shouldn't be null");
while (__x->__left_ != nullptr)
__x = __x->__left_;
return __x;
}
// Returns: pointer to the right-most node under __x.
-// Precondition: __x != nullptr.
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
_NodePtr
__tree_max(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "Root node shouldn't be null");
while (__x->__right_ != nullptr)
__x = __x->__right_;
return __x;
}
// Returns: pointer to the next in-order node after __x.
-// Precondition: __x != nullptr.
template <class _NodePtr>
_NodePtr
__tree_next(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
if (__x->__right_ != nullptr)
return _VSTD::__tree_min(__x->__right_);
while (!_VSTD::__tree_is_left_child(__x))
@@ -182,6 +182,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_EndNodePtr
__tree_next_iter(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
if (__x->__right_ != nullptr)
return static_cast<_EndNodePtr>(_VSTD::__tree_min(__x->__right_));
while (!_VSTD::__tree_is_left_child(__x))
@@ -190,13 +191,13 @@ __tree_next_iter(_NodePtr __x) _NOEXCEPT
}
// Returns: pointer to the previous in-order node before __x.
-// Precondition: __x != nullptr.
// Note: __x may be the end node.
template <class _NodePtr, class _EndNodePtr>
inline _LIBCPP_INLINE_VISIBILITY
_NodePtr
__tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
if (__x->__left_ != nullptr)
return _VSTD::__tree_max(__x->__left_);
_NodePtr __xx = static_cast<_NodePtr>(__x);
@@ -206,11 +207,11 @@ __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT
}
// Returns: pointer to a node which has no children
-// Precondition: __x != nullptr.
template <class _NodePtr>
_NodePtr
__tree_leaf(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
while (true)
{
if (__x->__left_ != nullptr)
@@ -230,11 +231,12 @@ __tree_leaf(_NodePtr __x) _NOEXCEPT
// Effects: Makes __x->__right_ the subtree root with __x as its left child
// while preserving in-order order.
-// Precondition: __x->__right_ != nullptr
template <class _NodePtr>
void
__tree_left_rotate(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT(__x->__right_ != nullptr, "node should have a right child");
_NodePtr __y = __x->__right_;
__x->__right_ = __y->__left_;
if (__x->__right_ != nullptr)
@@ -250,11 +252,12 @@ __tree_left_rotate(_NodePtr __x) _NOEXCEPT
// Effects: Makes __x->__left_ the subtree root with __x as its right child
// while preserving in-order order.
-// Precondition: __x->__left_ != nullptr
template <class _NodePtr>
void
__tree_right_rotate(_NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null");
+ _LIBCPP_ASSERT(__x->__left_ != nullptr, "node should have a left child");
_NodePtr __y = __x->__left_;
__x->__left_ = __y->__right_;
if (__x->__left_ != nullptr)
@@ -269,8 +272,7 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
}
// Effects: Rebalances __root after attaching __x to a leaf.
-// Precondition: __root != nulptr && __x != nullptr.
-// __x has no children.
+// Precondition: __x has no children.
// __x == __root or == a direct or indirect child of __root.
// If __x were to be unlinked from __root (setting __root to
// nullptr if __root == __x), __tree_invariant(__root) == true.
@@ -280,6 +282,8 @@ template <class _NodePtr>
void
__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__root != nullptr, "Root of the tree shouldn't be null");
+ _LIBCPP_ASSERT(__x != nullptr, "Can't attach null node to a leaf");
__x->__is_black_ = __x == __root;
while (__x != __root && !__x->__parent_unsafe()->__is_black_)
{
@@ -339,9 +343,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
}
}
-// Precondition: __root != nullptr && __z != nullptr.
-// __tree_invariant(__root) == true.
-// __z == __root or == a direct or indirect child of __root.
+// Precondition: __z == __root or == a direct or indirect child of __root.
// Effects: unlinks __z from the tree rooted at __root, rebalancing as needed.
// Postcondition: __tree_invariant(end_node->__left_) == true && end_node->__left_
// nor any of its children refer to __z. end_node->__left_
@@ -350,6 +352,9 @@ template <class _NodePtr>
void
__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
{
+ _LIBCPP_ASSERT(__root != nullptr, "Root node should not be null");
+ _LIBCPP_ASSERT(__z != nullptr, "The node to remove should not be null");
+ _LIBCPP_DEBUG_ASSERT(__tree_invariant(__root), "The tree invariants should hold");
// __z will be removed from the tree. Client still needs to destruct/deallocate it
// __y is either __z, or if __z has two children, __tree_next(__z).
// __y will have at most one child.
diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm
index a86e466450..c30e3a6ce9 100644
--- a/contrib/libs/cxxsupp/libcxx/include/algorithm
+++ b/contrib/libs/cxxsupp/libcxx/include/algorithm
@@ -238,6 +238,33 @@ namespace ranges {
requires indirectly_copyable<iterator_t<R>, I>
constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
ranges::copy_backward(R&& r, I result); // since C++20
+
+ template<class I, class F>
+ using for_each_result = in_fun_result<I, F>; // since C++20
+
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirectly_unary_invocable<projected<I, Proj>> Fun>
+ constexpr ranges::for_each_result<I, Fun>
+ ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
+
+ template<input_range R, class Proj = identity,
+ indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
+ constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
+ ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
+
+ template<input_iterator I, class Proj = identity,
+ indirectly_unary_invocable<projected<I, Proj>> Fun>
+ constexpr ranges::for_each_n_result<I, Fun>
+ ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
+
+ template<input_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirect_unary_predicate<projected<I, Proj>> Pred>
+ constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
+
+ template<input_range R, class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
+
}
constexpr bool // constexpr in C++20
@@ -963,6 +990,9 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_find.h>
#include <__algorithm/ranges_find_if.h>
#include <__algorithm/ranges_find_if_not.h>
+#include <__algorithm/ranges_for_each.h>
+#include <__algorithm/ranges_for_each_n.h>
+#include <__algorithm/ranges_is_partitioned.h>
#include <__algorithm/ranges_max.h>
#include <__algorithm/ranges_max_element.h>
#include <__algorithm/ranges_min.h>
diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic
index 1defb38bee..48c358f5ac 100644
--- a/contrib/libs/cxxsupp/libcxx/include/atomic
+++ b/contrib/libs/cxxsupp/libcxx/include/atomic
@@ -542,7 +542,7 @@ template <class T>
# error <atomic> is not implemented
#endif
#ifdef kill_dependency
-# error C++ standard library is incompatible with <stdatomic.h>
+# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23.
#endif
#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
@@ -1472,11 +1472,11 @@ struct __cxx_atomic_impl : public _Base {
: _Base(value) {}
};
-#ifdef __linux__
+#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
using __cxx_contention_t = int32_t;
#else
using __cxx_contention_t = int64_t;
-#endif //__linux__
+#endif // __linux__ || (_AIX && !__64BIT__)
using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
diff --git a/contrib/libs/cxxsupp/libcxx/include/charconv b/contrib/libs/cxxsupp/libcxx/include/charconv
index ca717dc4a0..d5e485a367 100644
--- a/contrib/libs/cxxsupp/libcxx/include/charconv
+++ b/contrib/libs/cxxsupp/libcxx/include/charconv
@@ -319,6 +319,197 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
return __to_chars_integral(__first, __last, __x, __base, false_type());
}
+namespace __itoa {
+
+static constexpr char __base_2_lut[64] = {
+ '0', '0', '0', '0',
+ '0', '0', '0', '1',
+ '0', '0', '1', '0',
+ '0', '0', '1', '1',
+ '0', '1', '0', '0',
+ '0', '1', '0', '1',
+ '0', '1', '1', '0',
+ '0', '1', '1', '1',
+ '1', '0', '0', '0',
+ '1', '0', '0', '1',
+ '1', '0', '1', '0',
+ '1', '0', '1', '1',
+ '1', '1', '0', '0',
+ '1', '1', '0', '1',
+ '1', '1', '1', '0',
+ '1', '1', '1', '1'
+};
+
+static constexpr char __base_8_lut[128] = {
+ '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7',
+ '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7',
+ '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7',
+ '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7',
+ '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7',
+ '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7',
+ '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7',
+ '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'
+};
+
+static constexpr char __base_16_lut[512] = {
+ '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0', 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f',
+ '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f',
+ '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '2', 'a', '2', 'b', '2', 'c', '2', 'd', '2', 'e', '2', 'f',
+ '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', '3', 'a', '3', 'b', '3', 'c', '3', 'd', '3', 'e', '3', 'f',
+ '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '4', 'a', '4', 'b', '4', 'c', '4', 'd', '4', 'e', '4', 'f',
+ '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '5', 'a', '5', 'b', '5', 'c', '5', 'd', '5', 'e', '5', 'f',
+ '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', '6', 'a', '6', 'b', '6', 'c', '6', 'd', '6', 'e', '6', 'f',
+ '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '7', 'a', '7', 'b', '7', 'c', '7', 'd', '7', 'e', '7', 'f',
+ '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', '8', 'a', '8', 'b', '8', 'c', '8', 'd', '8', 'e', '8', 'f',
+ '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9', '9', 'a', '9', 'b', '9', 'c', '9', 'd', '9', 'e', '9', 'f',
+ 'a', '0', 'a', '1', 'a', '2', 'a', '3', 'a', '4', 'a', '5', 'a', '6', 'a', '7', 'a', '8', 'a', '9', 'a', 'a', 'a', 'b', 'a', 'c', 'a', 'd', 'a', 'e', 'a', 'f',
+ 'b', '0', 'b', '1', 'b', '2', 'b', '3', 'b', '4', 'b', '5', 'b', '6', 'b', '7', 'b', '8', 'b', '9', 'b', 'a', 'b', 'b', 'b', 'c', 'b', 'd', 'b', 'e', 'b', 'f',
+ 'c', '0', 'c', '1', 'c', '2', 'c', '3', 'c', '4', 'c', '5', 'c', '6', 'c', '7', 'c', '8', 'c', '9', 'c', 'a', 'c', 'b', 'c', 'c', 'c', 'd', 'c', 'e', 'c', 'f',
+ 'd', '0', 'd', '1', 'd', '2', 'd', '3', 'd', '4', 'd', '5', 'd', '6', 'd', '7', 'd', '8', 'd', '9', 'd', 'a', 'd', 'b', 'd', 'c', 'd', 'd', 'd', 'e', 'd', 'f',
+ 'e', '0', 'e', '1', 'e', '2', 'e', '3', 'e', '4', 'e', '5', 'e', '6', 'e', '7', 'e', '8', 'e', '9', 'e', 'a', 'e', 'b', 'e', 'c', 'e', 'd', 'e', 'e', 'e', 'f',
+ 'f', '0', 'f', '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c', 'f', 'd', 'f', 'e', 'f', 'f'
+};
+
+template <unsigned _Base>
+struct _LIBCPP_HIDDEN __integral;
+
+template <>
+struct _LIBCPP_HIDDEN __integral<2> {
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
+ // If value == 0 still need one digit. If the value != this has no
+ // effect since the code scans for the most significant bit set. (Note
+ // that __libcpp_clz doesn't work for 0.)
+ return numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1);
+ }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) {
+ ptrdiff_t __cap = __last - __first;
+ int __n = __width(__value);
+ if (__n > __cap)
+ return {__last, errc::value_too_large};
+
+ __last = __first + __n;
+ char* __p = __last;
+ const unsigned __divisor = 16;
+ while (__value > __divisor) {
+ unsigned __c = __value % __divisor;
+ __value /= __divisor;
+ __p -= 4;
+ std::memcpy(__p, &__base_2_lut[4 * __c], 4);
+ }
+ do {
+ unsigned __c = __value % 2;
+ __value /= 2;
+ *--__p = "01"[__c];
+ } while (__value != 0);
+ return {__last, errc(0)};
+ }
+};
+
+template <>
+struct _LIBCPP_HIDDEN __integral<8> {
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
+ // If value == 0 still need one digit. If the value != this has no
+ // effect since the code scans for the most significat bit set. (Note
+ // that __libcpp_clz doesn't work for 0.)
+ return ((numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1)) + 2) / 3;
+ }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) {
+ ptrdiff_t __cap = __last - __first;
+ int __n = __width(__value);
+ if (__n > __cap)
+ return {__last, errc::value_too_large};
+
+ __last = __first + __n;
+ char* __p = __last;
+ unsigned __divisor = 64;
+ while (__value > __divisor) {
+ unsigned __c = __value % __divisor;
+ __value /= __divisor;
+ __p -= 2;
+ std::memcpy(__p, &__base_8_lut[2 * __c], 2);
+ }
+ do {
+ unsigned __c = __value % 8;
+ __value /= 8;
+ *--__p = "01234567"[__c];
+ } while (__value != 0);
+ return {__last, errc(0)};
+ }
+
+};
+
+template <>
+struct _LIBCPP_HIDDEN __integral<16> {
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
+ // If value == 0 still need one digit. If the value != this has no
+ // effect since the code scans for the most significat bit set. (Note
+ // that __libcpp_clz doesn't work for 0.)
+ return (numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1) + 3) / 4;
+ }
+
+ template <typename _Tp>
+ _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) {
+ ptrdiff_t __cap = __last - __first;
+ int __n = __width(__value);
+ if (__n > __cap)
+ return {__last, errc::value_too_large};
+
+ __last = __first + __n;
+ char* __p = __last;
+ unsigned __divisor = 256;
+ while (__value > __divisor) {
+ unsigned __c = __value % __divisor;
+ __value /= __divisor;
+ __p -= 2;
+ std::memcpy(__p, &__base_16_lut[2 * __c], 2);
+ }
+ if (__first != __last)
+ do {
+ unsigned __c = __value % 16;
+ __value /= 16;
+ *--__p = "0123456789abcdef"[__c];
+ } while (__value != 0);
+ return {__last, errc(0)};
+ }
+};
+
+} // namespace __itoa
+
+template <unsigned _Base, typename _Tp,
+ typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0>
+_LIBCPP_HIDE_FROM_ABI int
+__to_chars_integral_width(_Tp __value) {
+ return __itoa::__integral<_Base>::__width(__value);
+}
+
+template <unsigned _Base, typename _Tp,
+ typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0>
+_LIBCPP_HIDE_FROM_ABI int
+__to_chars_integral_width(_Tp __value) {
+ return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value));
+}
+
+template <unsigned _Base, typename _Tp,
+ typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0>
+_LIBCPP_HIDE_FROM_ABI to_chars_result
+__to_chars_integral(char* __first, char* __last, _Tp __value) {
+ return __itoa::__integral<_Base>::__to_chars(__first, __last, __value);
+}
+
+template <unsigned _Base, typename _Tp,
+ typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0>
+_LIBCPP_HIDE_FROM_ABI to_chars_result
+__to_chars_integral(char* __first, char* __last, _Tp __value) {
+ return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value));
+}
+
template <typename _Tp>
_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_HIDE_FROM_ABI int
__to_chars_integral_width(_Tp __value, unsigned __base) {
@@ -352,9 +543,18 @@ inline _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
false_type)
{
- if (__base == 10)
+ if (__base == 10) [[likely]]
return __to_chars_itoa(__first, __last, __value, false_type());
+ switch (__base) {
+ case 2:
+ return __to_chars_integral<2>(__first, __last, __value);
+ case 8:
+ return __to_chars_integral<8>(__first, __last, __value);
+ case 16:
+ return __to_chars_integral<16>(__first, __last, __value);
+ }
+
ptrdiff_t __cap = __last - __first;
int __n = __to_chars_integral_width(__value, __base);
if (__n > __cap)
diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format
index 951627852f..070bfe286f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/format
+++ b/contrib/libs/cxxsupp/libcxx/include/format
@@ -127,6 +127,7 @@ namespace std {
#include <__config>
#include <__debug>
#include <__format/buffer.h>
+#include <__format/concepts.h>
#include <__format/enable_insertable.h>
#include <__format/format_arg.h>
#include <__format/format_args.h>
diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list
index 87da2b17e2..f362ef38aa 100644
--- a/contrib/libs/cxxsupp/libcxx/include/list
+++ b/contrib/libs/cxxsupp/libcxx/include/list
@@ -679,13 +679,6 @@ private:
void __move_assign_alloc(__list_imp&, false_type)
_NOEXCEPT
{}
-
- _LIBCPP_INLINE_VISIBILITY
- void __invalidate_all_iterators() {
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
- }
};
// Unlink nodes [__f, __l]
@@ -727,9 +720,7 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
template <class _Tp, class _Alloc>
__list_imp<_Tp, _Alloc>::~__list_imp() {
clear();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__erase_c(this);
-#endif
+ std::__debug_db_erase_c(this);
}
template <class _Tp, class _Alloc>
@@ -750,7 +741,7 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
}
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
}
@@ -1373,9 +1364,7 @@ list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
insert(__e, __f, __l);
else
erase(__i, __e);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
+ std::__debug_db_invalidate_all(this);
}
template <class _Tp, class _Alloc>
@@ -1390,9 +1379,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
insert(__e, __n, __x);
else
erase(__i, __e);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
+ std::__debug_db_invalidate_all(this);
}
template <class _Tp, class _Alloc>
diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale
index 98d1d09af3..d0302db58d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/locale
+++ b/contrib/libs/cxxsupp/libcxx/include/locale
@@ -1936,7 +1936,7 @@ time_get<_CharT, _InputIterator>::__get_month(int& __m,
const ctype<char_type>& __ct) const
{
int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1;
- if (!(__err & ios_base::failbit) && __t <= 11)
+ if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11)
__m = __t;
else
__err |= ios_base::failbit;
diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span
index 6b1d4b9aae..75d00c14bf 100644
--- a/contrib/libs/cxxsupp/libcxx/include/span
+++ b/contrib/libs/cxxsupp/libcxx/include/span
@@ -130,6 +130,7 @@ template<class R>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__debug>
+#include <__fwd/span.h>
#include <__iterator/concepts.h>
#include <__iterator/wrap_iter.h>
#include <__ranges/concepts.h>
@@ -155,9 +156,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER > 17
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-template <typename _Tp, size_t _Extent = dynamic_extent> class span;
-
template <class _Tp>
struct __is_std_array : false_type {};
diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string
index e47984f43e..3602fc046a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/string
+++ b/contrib/libs/cxxsupp/libcxx/include/string
@@ -682,6 +682,7 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
+ static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
@@ -699,14 +700,13 @@ private:
struct __short
{
value_type __data_[__min_cap];
- unsigned char __padding[sizeof(value_type) - 1];
- unsigned char __size_ : 7;
- unsigned char __is_long_ : 1;
+ unsigned char __padding_[sizeof(value_type) - 1];
+ size_type __size_ : 7;
+ size_type __is_long_ : 1;
};
// The __endian_factor is required because the field we use to store the size
-// (either size_type or unsigned char depending on long/short) has one fewer
-// bit than it would if it were not a bitfield.
+// has one fewer bit than it would if it were not a bitfield.
//
// If the LSB is used to store the short-flag in the short string representation,
// we have to multiply the size by two when it is stored and divide it by two when
@@ -745,14 +745,9 @@ private:
struct __short
{
- union
- {
- struct {
- unsigned char __is_long_ : 1;
- unsigned char __size_ : 7;
- };
- value_type __lx;
- };
+ size_type __is_long_ : 1;
+ size_type __size_ : 7;
+ char __padding_[sizeof(value_type) - 1];
value_type __data_[__min_cap];
};
@@ -1816,7 +1811,6 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_all_iterators();
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_iterators_past(size_type);
template<class _Tp>
@@ -1892,17 +1886,6 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
-basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
-{
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (!__libcpp_is_constant_evaluated())
- __get_db()->__invalidate_all(this);
-#endif
-}
-
-template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX17
-void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
{
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -2106,10 +2089,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
{
__str.__default_init();
std::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (!__libcpp_is_constant_evaluated() && __is_long())
- __get_db()->swap(this, &__str);
-#endif
+ if (__is_long())
+ std::__debug_db_swap(this, &__str);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2130,10 +2111,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
__str.__default_init();
}
std::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (!__libcpp_is_constant_evaluated() && __is_long())
- __get_db()->swap(this, &__str);
-#endif
+ if (__is_long())
+ std::__debug_db_swap(this, &__str);
}
#endif // _LIBCPP_CXX03_LANG
@@ -2371,10 +2350,7 @@ template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (!__libcpp_is_constant_evaluated())
- __get_db()->__erase_c(this);
-#endif
+ std::__debug_db_erase_c(this);
if (__is_long())
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
}
@@ -2396,7 +2372,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
pointer __p = __allocation.ptr;
__begin_lifetime(__p, __allocation.count);
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
if (__n_copy != 0)
traits_type::copy(std::__to_address(__p),
std::__to_address(__old_p), __n_copy);
@@ -2431,7 +2407,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
pointer __p = __allocation.ptr;
__begin_lifetime(__p, __allocation.count);
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
if (__n_copy != 0)
traits_type::copy(std::__to_address(__p),
std::__to_address(__old_p), __n_copy);
@@ -3369,7 +3345,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
{
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
if (__is_long())
{
traits_type::assign(*__get_long_pointer(), value_type());
@@ -3520,7 +3496,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
}
else
__set_short_size(__sz);
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3629,15 +3605,12 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
__is_nothrow_swappable<allocator_type>::value)
#endif
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- if (!__libcpp_is_constant_evaluated()) {
- if (!__is_long())
- __get_db()->__invalidate_all(this);
- if (!__str.__is_long())
- __get_db()->__invalidate_all(&__str);
- __get_db()->swap(this, &__str);
- }
-#endif
+ if (!__is_long())
+ std::__debug_db_invalidate_all(this);
+ if (!__str.__is_long())
+ std::__debug_db_invalidate_all(&__str);
+ std::__debug_db_swap(this, &__str);
+
_LIBCPP_ASSERT(
__alloc_traits::propagate_on_container_swap::value ||
__alloc_traits::is_always_equal::value ||
diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view
index 6864d29532..28fbe1a5f7 100644
--- a/contrib/libs/cxxsupp/libcxx/include/string_view
+++ b/contrib/libs/cxxsupp/libcxx/include/string_view
@@ -199,6 +199,7 @@ namespace std {
#include <__algorithm/min.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__fwd/string_view.h>
#include <__ranges/concepts.h>
#include <__ranges/data.h>
#include <__ranges/enable_borrowed_range.h>
@@ -228,19 +229,6 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _CharT, class _Traits = char_traits<_CharT> >
- class _LIBCPP_TEMPLATE_VIS basic_string_view;
-
-typedef basic_string_view<char> string_view;
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef basic_string_view<char8_t> u8string_view;
-#endif
-typedef basic_string_view<char16_t> u16string_view;
-typedef basic_string_view<char32_t> u32string_view;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-typedef basic_string_view<wchar_t> wstring_view;
-#endif
-
// TODO: This is a workaround for some vendors to carry a downstream diff to accept `nullptr` in
// string_view constructors. This can be refactored when this exact form isn't needed anymore.
template <class _Traits>
diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map
index a31c2c6dde..e5741b0546 100644
--- a/contrib/libs/cxxsupp/libcxx/include/unordered_map
+++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map
@@ -1693,9 +1693,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
: __table_(_VSTD::move(__u.__table_))
{
_VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -1712,10 +1710,8 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
__u.__table_.remove((__i++).__i_)->__value_.__move());
}
}
-#if _LIBCPP_DEBUG_LEVEL == 2
else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -2469,9 +2465,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
: __table_(_VSTD::move(__u.__table_))
{
_VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -2489,10 +2483,8 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
__u.__table_.remove((__i++).__i_)->__value_.__move());
}
}
-#if _LIBCPP_DEBUG_LEVEL == 2
else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set
index f23de20456..de0e12197d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/unordered_set
+++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set
@@ -1006,9 +1006,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
: __table_(_VSTD::move(__u.__table_))
{
_VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1023,10 +1021,8 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
while (__u.size() != 0)
__table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
}
-#if _LIBCPP_DEBUG_LEVEL == 2
else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1647,9 +1643,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
: __table_(_VSTD::move(__u.__table_))
{
_VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1664,10 +1658,8 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
while (__u.size() != 0)
__table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
}
-#if _LIBCPP_DEBUG_LEVEL == 2
else
- __get_db()->swap(this, _VSTD::addressof(__u));
-#endif
+ std::__debug_db_swap(this, std::addressof(__u));
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector
index d4cfaed952..7e3fb0ee06 100644
--- a/contrib/libs/cxxsupp/libcxx/include/vector
+++ b/contrib/libs/cxxsupp/libcxx/include/vector
@@ -418,9 +418,7 @@ public:
~vector()
{
__annotate_delete();
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__erase_c(this);
-#endif
+ std::__debug_db_erase_c(this);
if (this->__begin_ != nullptr)
{
@@ -646,7 +644,7 @@ public:
size_type __old_size = size();
__clear();
__annotate_shrink(__old_size);
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
#if _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED
@@ -681,7 +679,6 @@ private:
__compressed_pair<pointer, allocator_type> __end_cap_ =
__compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
- _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last);
@@ -943,7 +940,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
_VSTD::swap(this->__end_cap(), __v.__end_cap());
__v.__first_ = __v.__begin_;
__annotate_new(size());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _Tp, class _Allocator>
@@ -959,7 +956,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
_VSTD::swap(this->__end_cap(), __v.__end_cap());
__v.__first_ = __v.__begin_;
__annotate_new(size());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
return __r;
}
@@ -1241,9 +1238,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
: __end_cap_(nullptr, _VSTD::move(__x.__alloc()))
{
_VSTD::__debug_db_insert_c(this);
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__x));
-#endif
+ std::__debug_db_swap(this, std::addressof(__x));
this->__begin_ = __x.__begin_;
this->__end_ = __x.__end_;
this->__end_cap() = __x.__end_cap();
@@ -1262,9 +1257,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_
this->__end_ = __x.__end_;
this->__end_cap() = __x.__end_cap();
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__x));
-#endif
+ std::__debug_db_swap(this, std::addressof(__x));
}
else
{
@@ -1334,9 +1327,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
this->__end_ = __c.__end_;
this->__end_cap() = __c.__end_cap();
__c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__c));
-#endif
+ std::__debug_db_swap(this, std::addressof(__c));
}
#endif // !_LIBCPP_CXX03_LANG
@@ -1407,7 +1398,7 @@ vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __las
__vallocate(__recommend(__new_size));
__construct_at_end(__first, __last, __new_size);
}
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _Tp, class _Allocator>
@@ -1429,7 +1420,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
__vallocate(__recommend(static_cast<size_type>(__n)));
__construct_at_end(__n, __u);
}
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _Tp, class _Allocator>
@@ -1998,9 +1989,7 @@ vector<_Tp, _Allocator>::swap(vector& __x)
_VSTD::swap(this->__end_cap(), __x.__end_cap());
_VSTD::__swap_allocator(this->__alloc(), __x.__alloc(),
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, _VSTD::addressof(__x));
-#endif
+ std::__debug_db_swap(this, std::addressof(__x));
}
template <class _Tp, class _Allocator>
@@ -2061,17 +2050,6 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
-vector<_Tp, _Allocator>::__invalidate_all_iterators()
-{
-#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__invalidate_all(this);
-#endif
-}
-
-
-template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-void
vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
#if _LIBCPP_DEBUG_LEVEL == 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
@@ -2393,7 +2371,6 @@ private:
// Precondition: __n > 0
// Postcondition: capacity() >= __n
// Postcondition: size() == 0
- _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
_LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
if (__n > max_size())
__throw_length_error();
@@ -2484,20 +2461,13 @@ private:
};
template <class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-vector<bool, _Allocator>::__invalidate_all_iterators()
-{
-}
-
-template <class _Allocator>
void
vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT
{
if (this->__begin_ != nullptr)
{
__storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
this->__begin_ = nullptr;
this->__size_ = this->__cap() = 0;
}
@@ -2670,7 +2640,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
{
if (__begin_ != nullptr)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2697,7 +2667,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
{
if (__begin_ != nullptr)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2772,7 +2742,7 @@ vector<bool, _Allocator>::~vector()
{
if (__begin_ != nullptr)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _Allocator>
@@ -2916,7 +2886,7 @@ vector<bool, _Allocator>::assign(size_type __n, const value_type& __x)
}
_VSTD::fill_n(begin(), __n, __x);
}
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
template <class _Allocator>
@@ -2970,7 +2940,7 @@ vector<bool, _Allocator>::reserve(size_type __n)
__v.__vallocate(__n);
__v.__construct_at_end(this->begin(), this->end());
swap(__v);
- __invalidate_all_iterators();
+ std::__debug_db_invalidate_all(this);
}
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version
index b8d03ac651..bb8ec21d01 100644
--- a/contrib/libs/cxxsupp/libcxx/include/version
+++ b/contrib/libs/cxxsupp/libcxx/include/version
@@ -404,7 +404,7 @@ __cpp_lib_void_t 201411L <type_traits>
// # define __cpp_lib_reference_from_temporary 202202L
// # define __cpp_lib_spanstream 202106L
// # define __cpp_lib_stacktrace 202011L
-// # define __cpp_lib_stdatomic_h 202011L
+# define __cpp_lib_stdatomic_h 202011L
# define __cpp_lib_string_contains 202011L
# define __cpp_lib_string_resize_and_overwrite 202110L
# define __cpp_lib_to_underlying 202102L
diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp
index 5db0115f65..e205f0f7ad 100644
--- a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp
+++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp
@@ -1888,7 +1888,7 @@ path path::lexically_relative(const path& base) const {
if (ElemCount == 0 && (PP.atEnd() || *PP == PATHSTR("")))
return PATHSTR(".");
- // return a path constructed with 'n' dot-dot elements, followed by the the
+ // return a path constructed with 'n' dot-dot elements, followed by the
// elements of '*this' after the mismatch.
path Result;
// FIXME: Reserve enough room in Result that it won't have to re-allocate.
diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make
index fb6c4197a0..d68f266dc5 100644
--- a/contrib/libs/cxxsupp/libcxx/ya.make
+++ b/contrib/libs/cxxsupp/libcxx/ya.make
@@ -13,9 +13,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2022-05-01)
+VERSION(2022-05-18)
-ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/639b9618f46d75f4dabd2082b3f6ba8433c287bf.tar.gz)
+ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/f0e61029506fd63bb300f2dbbd65ba792e4ef3a2.tar.gz)
ADDINCL(
GLOBAL contrib/libs/cxxsupp/libcxx/include
@@ -100,9 +100,7 @@ IF (OS_LINUX)
ENDIF()
IF (CLANG)
- CXXFLAGS(
- GLOBAL -nostdinc++
- )
+ CXXFLAGS(GLOBAL -nostdinc++)
ENDIF()
# The CXX_RT variable controls which C++ runtime is used.