diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-04-27 10:51:39 +0300 |
---|---|---|
committer | Andrey Khalyavin <halyavin@gmail.com> | 2022-04-27 10:51:39 +0300 |
commit | 3f6c53a98f6f42f15b76a5c0bdbde523093e0a42 (patch) | |
tree | c2a7b9857c15eb5333495031eb782365c62311b4 /contrib/libs | |
parent | 590e169a0a90aafab8247e6f1797b646d897f086 (diff) | |
download | ydb-3f6c53a98f6f42f15b76a5c0bdbde523093e0a42.tar.gz |
Update libc++ to a2afc824 (24 Jan 2022).
Notable changes:
* update header for __cpp_lib_polymorphic_allocator in the comments
* do not inherit view_interface from view_base because it is not required
* use std::addressof in unordered_set and unordered_map headers to protect from operator overloading
* remove unneeded __regex_word symbol for z/OS
* remove non-standard month_weekday constructor
* remove __function_like helper which is no longer needed
* allow callbacks that accept rvalues in std::string::resize_and_overwrite
ref:0c64323bc4ef2d909ee4e876a60e9bbd152830aa
Diffstat (limited to 'contrib/libs')
18 files changed, 103 insertions, 214 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import index 620ce17090..b8cb8a84e0 100755 --- a/contrib/libs/cxxsupp/libcxx/import +++ b/contrib/libs/cxxsupp/libcxx/import @@ -1,6 +1,6 @@ #!/bin/sh -e -rev=429a717e +rev=a2afc824 output_dir="libcxx-r$rev" if [ -z $1 ] ; then git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp" diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/calendar.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/calendar.h index ce5eb60e5b..ca9bca7b5e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/calendar.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/calendar.h @@ -540,7 +540,6 @@ private: chrono::month __m; chrono::weekday_indexed __wdi; public: - month_weekday() = default; constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept : __m{__mval}, __wdi{__wdival} {} inline constexpr chrono::month month() const noexcept { return __m; } diff --git a/contrib/libs/cxxsupp/libcxx/include/__function_like.h b/contrib/libs/cxxsupp/libcxx/include/__function_like.h deleted file mode 100644 index 4075355174..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__function_like.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- 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___ITERATOR_FUNCTION_LIKE_H -#define _LIBCPP___ITERATOR_FUNCTION_LIKE_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_HAS_NO_RANGES) - -namespace ranges { -// Per [range.iter.ops.general] and [algorithms.requirements], functions in namespace std::ranges -// can't be found by ADL and inhibit ADL when found by unqualified lookup. The easiest way to -// facilitate this is to use function objects. -// -// Since these are still standard library functions, we use `__function_like` to eliminate most of -// the properties that function objects get by default (e.g. semiregularity, addressability), to -// limit the surface area of the unintended public interface, so as to curb the effect of Hyrum's -// law. -struct __function_like { - __function_like() = delete; - __function_like(__function_like const&) = delete; - __function_like& operator=(__function_like const&) = delete; - - void operator&() const = delete; - - struct __tag { }; - -protected: - constexpr explicit __function_like(__tag) noexcept {} - ~__function_like() = default; -}; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___ITERATOR_FUNCTION_LIKE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table index 71f892efc0..b470ea53cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__hash_table +++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table @@ -315,9 +315,9 @@ public: _LIBCPP_INLINE_VISIBILITY __hash_iterator& operator=(const __hash_iterator& __i) { - if (this != &__i) + if (this != _VSTD::addressof(__i)) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); __node_ = __i.__node_; } return *this; @@ -413,7 +413,7 @@ public: : __node_(__x.__node_) { #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__iterator_copy(this, &__x); + __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); #endif } @@ -422,7 +422,7 @@ public: __hash_const_iterator(const __hash_const_iterator& __i) : __node_(__i.__node_) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); } _LIBCPP_INLINE_VISIBILITY @@ -434,9 +434,9 @@ public: _LIBCPP_INLINE_VISIBILITY __hash_const_iterator& operator=(const __hash_const_iterator& __i) { - if (this != &__i) + if (this != _VSTD::addressof(__i)) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); __node_ = __i.__node_; } return *this; @@ -530,7 +530,7 @@ public: __bucket_(__i.__bucket_), __bucket_count_(__i.__bucket_count_) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); } _LIBCPP_INLINE_VISIBILITY @@ -542,9 +542,9 @@ public: _LIBCPP_INLINE_VISIBILITY __hash_local_iterator& operator=(const __hash_local_iterator& __i) { - if (this != &__i) + if (this != _VSTD::addressof(__i)) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); __node_ = __i.__node_; __bucket_ = __i.__bucket_; __bucket_count_ = __i.__bucket_count_; @@ -662,7 +662,7 @@ public: __bucket_count_(__x.__bucket_count_) { #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__iterator_copy(this, &__x); + __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); #endif } @@ -673,7 +673,7 @@ public: __bucket_(__i.__bucket_), __bucket_count_(__i.__bucket_count_) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); } _LIBCPP_INLINE_VISIBILITY @@ -685,9 +685,9 @@ public: _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i) { - if (this != &__i) + if (this != _VSTD::addressof(__i)) { - __get_db()->__iterator_copy(this, &__i); + __get_db()->__iterator_copy(this, _VSTD::addressof(__i)); __node_ = __i.__node_; __bucket_ = __i.__bucket_; __bucket_count_ = __i.__bucket_count_; @@ -1622,7 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( __u.size() = 0; } #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -2028,7 +2028,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( const_iterator __p, __node_pointer __cp) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" " referring to this unordered container"); if (__p != end() && key_eq()(*__p, __cp->__value_)) @@ -2155,7 +2155,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( const_iterator __p, _Args&&... __args) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" " referring to this unordered container"); __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); @@ -2479,7 +2479,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) { __next_pointer __np = __p.__node_; - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered container erase(iterator) called with an iterator not" " referring to this container"); _LIBCPP_DEBUG_ASSERT(__p != end(), @@ -2499,10 +2499,10 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_iterator __last) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__first)) == this, "unordered container::erase(iterator, iterator) called with an iterator not" " referring to this container"); - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__last)) == this, "unordered container::erase(iterator, iterator) called with an iterator not" " referring to this container"); for (const_iterator __p = __first; __first != __last; __p = __first) @@ -2734,7 +2734,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) __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, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h index 828bb71d5a..90c7fb4731 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h @@ -12,7 +12,6 @@ #include <__config> #include <__debug> -#include <__function_like.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> @@ -72,7 +71,7 @@ void advance(_InputIter& __i, _Distance __orig_n) { namespace ranges { namespace __advance { -struct __fn final : private __function_like { +struct __fn { private: template <class _Tp> _LIBCPP_HIDE_FROM_ABI @@ -99,8 +98,6 @@ private: } public: - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - // Preconditions: If `I` does not model `bidirectional_iterator`, `n` is not negative. template <input_or_output_iterator _Ip> _LIBCPP_HIDE_FROM_ABI @@ -191,7 +188,7 @@ public: } // namespace __advance inline namespace __cpo { - inline constexpr auto advance = __advance::__fn(__function_like::__tag()); + inline constexpr auto advance = __advance::__fn{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h index 9af8f5f45d..9c17413958 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h @@ -12,7 +12,6 @@ #include <__config> #include <__debug> -#include <__function_like.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> @@ -43,10 +42,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 namespace ranges { namespace __next { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <input_or_output_iterator _Ip> _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { @@ -79,7 +75,7 @@ struct __fn final : private __function_like { } // namespace __next inline namespace __cpo { - inline constexpr auto next = __next::__fn(__function_like::__tag()); + inline constexpr auto next = __next::__fn{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h index e8966a9aad..7e6e468cf3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h @@ -12,7 +12,6 @@ #include <__config> #include <__debug> -#include <__function_like.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> @@ -42,10 +41,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 namespace ranges { namespace __prev { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <bidirectional_iterator _Ip> _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { @@ -71,7 +67,7 @@ struct __fn final : private __function_like { } // namespace __prev inline namespace __cpo { - inline constexpr auto prev = __prev::__fn(__function_like::__tag()); + inline constexpr auto prev = __prev::__fn{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/readable_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/readable_traits.h index 90121bea80..13f323e295 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/readable_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/readable_traits.h @@ -57,14 +57,14 @@ template<__has_member_element_type _Tp> struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {}; -// Pre-emptively applies LWG3541 template<__has_member_value_type _Tp> -requires __has_member_element_type<_Tp> + requires __has_member_element_type<_Tp> struct indirectly_readable_traits<_Tp> {}; + template<__has_member_value_type _Tp> -requires __has_member_element_type<_Tp> && - same_as<remove_cv_t<typename _Tp::element_type>, - remove_cv_t<typename _Tp::value_type>> + requires __has_member_element_type<_Tp> && + same_as<remove_cv_t<typename _Tp::element_type>, + remove_cv_t<typename _Tp::value_type>> struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale index 0cde655a63..98fcd62a7c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale +++ b/contrib/libs/cxxsupp/libcxx/include/__locale @@ -518,8 +518,7 @@ public: # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT #elif defined(__MVS__) - static const mask __regex_word = 0x8000; -# if defined(__NATIVE_ASCII_F)` +# if defined(__NATIVE_ASCII_F) typedef unsigned int mask; static const mask space = _ISSPACE_A; static const mask print = _ISPRINT_A; @@ -544,6 +543,7 @@ public: static const mask xdigit = __ISXDIGIT; static const mask blank = __ISBLANK; # endif + static const mask __regex_word = 0x8000; #else # error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE? #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h index 9b0edb7c25..1a72da7396 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h @@ -12,7 +12,6 @@ #include <__concepts/destructible.h> #include <__config> -#include <__function_like.h> #include <__iterator/incrementable_traits.h> #include <__iterator/readable_traits.h> #include <__memory/concepts.h> @@ -37,9 +36,7 @@ namespace ranges { namespace __construct_at { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template<class _Tp, class... _Args, class = decltype( ::new (declval<void*>()) _Tp(declval<_Args>()...) )> @@ -52,16 +49,14 @@ struct __fn final : private __function_like { } // namespace __construct_at inline namespace __cpo { - inline constexpr auto construct_at = __construct_at::__fn(__function_like::__tag()); + inline constexpr auto construct_at = __construct_at::__fn{}; } // namespace __cpo // destroy_at namespace __destroy_at { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <destructible _Tp> _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept { @@ -72,16 +67,14 @@ struct __fn final : private __function_like { } // namespace __destroy_at inline namespace __cpo { - inline constexpr auto destroy_at = __destroy_at::__fn(__function_like::__tag()); + inline constexpr auto destroy_at = __destroy_at::__fn{}; } // namespace __cpo // destroy namespace __destroy { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel> requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI @@ -100,16 +93,14 @@ struct __fn final : private __function_like { } // namespace __destroy inline namespace __cpo { - inline constexpr auto destroy = __destroy::__fn(__function_like::__tag()); + inline constexpr auto destroy = __destroy::__fn{}; } // namespace __cpo // destroy_n namespace __destroy_n { -struct __fn final : private __function_like { - _LIBCPP_HIDE_FROM_ABI constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_input_iterator _InputIterator> requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI @@ -121,10 +112,11 @@ struct __fn final : private __function_like { } // namespace __destroy_n inline namespace __cpo { - inline constexpr auto destroy_n = __destroy_n::__fn(__function_like::__tag()); + inline constexpr auto destroy_n = __destroy_n::__fn{}; } // namespace __cpo } // namespace ranges + #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h index 8cd2748e45..6a8f9f070e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h @@ -13,7 +13,6 @@ #include <__algorithm/in_out_result.h> #include <__concepts/constructible.h> #include <__config> -#include <__function_like.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> #include <__iterator/iter_move.h> @@ -40,9 +39,7 @@ namespace ranges { namespace __uninitialized_default_construct { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> requires default_initializable<iter_value_t<_ForwardIterator>> @@ -62,16 +59,14 @@ struct __fn final : private __function_like { } // namespace __uninitialized_default_construct inline namespace __cpo { - inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{}; } // namespace __cpo // uninitialized_default_construct_n namespace __uninitialized_default_construct_n { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator> requires default_initializable<iter_value_t<_ForwardIterator>> _ForwardIterator operator()(_ForwardIterator __first, @@ -84,18 +79,14 @@ struct __fn final : private __function_like { } // namespace __uninitialized_default_construct_n inline namespace __cpo { - inline constexpr auto uninitialized_default_construct_n = - __uninitialized_default_construct_n::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{}; } // namespace __cpo // uninitialized_value_construct namespace __uninitialized_value_construct { -struct __fn final : private __function_like { - - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> requires default_initializable<iter_value_t<_ForwardIterator>> @@ -110,24 +101,19 @@ struct __fn final : private __function_like { borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const { return (*this)(ranges::begin(__range), ranges::end(__range)); } - }; } // namespace __uninitialized_value_construct inline namespace __cpo { - inline constexpr auto uninitialized_value_construct = - __uninitialized_value_construct::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{}; } // namespace __cpo // uninitialized_value_construct_n namespace __uninitialized_value_construct_n { -struct __fn final : private __function_like { - - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator> requires default_initializable<iter_value_t<_ForwardIterator>> _ForwardIterator operator()(_ForwardIterator __first, @@ -135,24 +121,19 @@ struct __fn final : private __function_like { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; return _VSTD::__uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n); } - }; } // namespace __uninitialized_value_construct_n inline namespace __cpo { - inline constexpr auto uninitialized_value_construct_n = - __uninitialized_value_construct_n::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{}; } // namespace __cpo // uninitialized_fill namespace __uninitialized_fill { -struct __fn final : private __function_like { - - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp> @@ -167,23 +148,19 @@ struct __fn final : private __function_like { borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range, const _Tp& __x) const { return (*this)(ranges::begin(__range), ranges::end(__range), __x); } - }; } // namespace __uninitialized_fill inline namespace __cpo { - inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{}; } // namespace __cpo // uninitialized_fill_n namespace __uninitialized_fill_n { -struct __fn final : private __function_like { - - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <__nothrow_forward_iterator _ForwardIterator, class _Tp> requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> _ForwardIterator operator()(_ForwardIterator __first, @@ -192,13 +169,12 @@ struct __fn final : private __function_like { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; return _VSTD::__uninitialized_fill_n<_ValueType>(_VSTD::move(__first), __n, __x); } - }; } // namespace __uninitialized_fill_n inline namespace __cpo { - inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{}; } // namespace __cpo // uninitialized_copy @@ -208,9 +184,7 @@ using uninitialized_copy_result = in_out_result<_InputIterator, _OutputIterator> namespace __uninitialized_copy { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <input_iterator _InputIterator, sentinel_for<_InputIterator> _Sentinel1, __nothrow_forward_iterator _OutputIterator, @@ -237,7 +211,7 @@ struct __fn final : private __function_like { } // namespace __uninitialized_copy inline namespace __cpo { - inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{}; } // namespace __cpo // uninitialized_copy_n @@ -247,9 +221,7 @@ using uninitialized_copy_n_result = in_out_result<_InputIterator, _OutputIterato namespace __uninitialized_copy_n { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <input_iterator _InputIterator, __nothrow_forward_iterator _OutputIterator, __nothrow_sentinel_for<_OutputIterator> _Sentinel> @@ -267,7 +239,7 @@ struct __fn final : private __function_like { } // namespace __uninitialized_copy_n inline namespace __cpo { - inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{}; } // namespace __cpo // uninitialized_move @@ -277,9 +249,7 @@ using uninitialized_move_result = in_out_result<_InputIterator, _OutputIterator> namespace __uninitialized_move { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <input_iterator _InputIterator, sentinel_for<_InputIterator> _Sentinel1, __nothrow_forward_iterator _OutputIterator, @@ -289,7 +259,6 @@ struct __fn final : private __function_like { operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; - auto __result = _VSTD::__uninitialized_move<_ValueType>(_VSTD::move(__ifirst), _VSTD::move(__ilast), _VSTD::move(__ofirst), _VSTD::move(__olast), __iter_move); return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; @@ -307,7 +276,7 @@ struct __fn final : private __function_like { } // namespace __uninitialized_move inline namespace __cpo { - inline constexpr auto uninitialized_move = __uninitialized_move::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_move = __uninitialized_move::__fn{}; } // namespace __cpo // uninitialized_move_n @@ -317,9 +286,7 @@ using uninitialized_move_n_result = in_out_result<_InputIterator, _OutputIterato namespace __uninitialized_move_n { -struct __fn final : private __function_like { - constexpr explicit __fn(__tag __x) noexcept : __function_like(__x) {} - +struct __fn { template <input_iterator _InputIterator, __nothrow_forward_iterator _OutputIterator, __nothrow_sentinel_for<_OutputIterator> _Sentinel> @@ -329,9 +296,8 @@ struct __fn final : private __function_like { _OutputIterator __ofirst, _Sentinel __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; - - auto __result = _VSTD::__uninitialized_move_n<_ValueType>(_VSTD::move(__ifirst), __n, _VSTD::move(__ofirst), - _VSTD::move(__olast), __iter_move); + auto __result = _VSTD::__uninitialized_move_n<_ValueType>(_VSTD::move(__ifirst), __n, + _VSTD::move(__ofirst), _VSTD::move(__olast), __iter_move); return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; } }; @@ -339,7 +305,7 @@ struct __fn final : private __function_like { } // namespace __uninitialized_move_n inline namespace __cpo { - inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn(__function_like::__tag()); + inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h index a09de11da8..e1daec046f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h @@ -12,6 +12,7 @@ #include <__config> #include <concepts> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -25,8 +26,17 @@ namespace ranges { struct view_base { }; +template<class _Derived> + requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> +class view_interface; + +template<class _Op, class _Yp> + requires is_convertible_v<_Op*, view_interface<_Yp>*> +void __is_derived_from_view_interface(const _Op*, const view_interface<_Yp>*); + template <class _Tp> -inline constexpr bool enable_view = derived_from<_Tp, view_base>; +inline constexpr bool enable_view = derived_from<_Tp, view_base> || + requires { ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr); }; } // end namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h index 8a1f5d8c92..c5215cbcb8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/view_interface.h @@ -18,7 +18,6 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/empty.h> -#include <__ranges/enable_view.h> #include <concepts> #include <type_traits> @@ -40,7 +39,7 @@ void __implicitly_convert_to(type_identity_t<_Tp>) noexcept; template<class _Derived> requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> -class view_interface : public view_base { +class view_interface { _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept { static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>); diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index c17ecc98aa..a927f9d0e6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -592,10 +592,7 @@ module std [system] { module __iterator { module access { private header "__iterator/access.h" } - module advance { - private header "__iterator/advance.h" - export __function_like - } + module advance { private header "__iterator/advance.h" } module back_insert_iterator { private header "__iterator/back_insert_iterator.h" } module common_iterator { private header "__iterator/common_iterator.h" } module concepts { private header "__iterator/concepts.h" } @@ -616,16 +613,10 @@ module std [system] { module iterator { private header "__iterator/iterator.h" } module iterator_traits { private header "__iterator/iterator_traits.h" } module move_iterator { private header "__iterator/move_iterator.h" } - module next { - private header "__iterator/next.h" - export __function_like - } + module next { private header "__iterator/next.h" } module ostream_iterator { private header "__iterator/ostream_iterator.h" } module ostreambuf_iterator { private header "__iterator/ostreambuf_iterator.h" } - module prev { - private header "__iterator/prev.h" - export __function_like - } + module prev { private header "__iterator/prev.h" } module projected { private header "__iterator/projected.h" } module readable_traits { private header "__iterator/readable_traits.h" } module reverse_access { private header "__iterator/reverse_access.h" } @@ -673,14 +664,8 @@ module std [system] { module concepts { private header "__memory/concepts.h" } module construct_at { private header "__memory/construct_at.h" } module pointer_traits { private header "__memory/pointer_traits.h" } - module ranges_construct_at { - private header "__memory/ranges_construct_at.h" - export __function_like - } - module ranges_uninitialized_algorithms { - private header "__memory/ranges_uninitialized_algorithms.h" - export __function_like - } + module ranges_construct_at { private header "__memory/ranges_construct_at.h" } + module ranges_uninitialized_algorithms { private header "__memory/ranges_uninitialized_algorithms.h" } module raw_storage_iterator { private header "__memory/raw_storage_iterator.h" } module shared_ptr { private header "__memory/shared_ptr.h" } module temporary_buffer { private header "__memory/temporary_buffer.h" } @@ -988,7 +973,6 @@ module std [system] { module __bits { private header "__bits" export * } module __debug { header "__debug" export * } module __errc { private header "__errc" export * } - module __function_like { private header "__function_like.h" export * } module __hash_table { header "__hash_table" export * } module __locale { private header "__locale" export * } module __mbstate_t { private header "__mbstate_t.h" export * } diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 95c7d1daec..50578ef989 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -1010,8 +1010,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) { __resize_default_init(__n); - pointer __data = data(); - __erase_to_end(_VSTD::move(__op)(__data, __n)); + __erase_to_end(_VSTD::move(__op)(data(), _LIBCPP_AUTO_CAST(__n))); } #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 73edadab20..361db707d2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -519,6 +519,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__functional/is_transparent.h> #include <__hash_table> #include <__iterator/iterator_traits.h> +#include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> #include <compare> @@ -1186,7 +1187,7 @@ public: {return __table_.__insert_unique(__x);} iterator insert(const_iterator __p, const value_type& __x) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_map::insert(const_iterator, const value_type&) called with an iterator not " "referring to this unordered_map"); ((void)__p); @@ -1207,7 +1208,7 @@ public: {return __table_.__insert_unique(_VSTD::move(__x));} iterator insert(const_iterator __p, value_type&& __x) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" " referring to this unordered_map"); ((void)__p); @@ -1225,7 +1226,7 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, _Pp&& __x) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" " referring to this unordered_map"); ((void)__p); @@ -1241,7 +1242,7 @@ public: template <class... _Args> _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" " referring to this unordered_map"); ((void)__p); @@ -1273,7 +1274,7 @@ public: _LIBCPP_INLINE_VISIBILITY iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this, "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" " referring to this unordered_map"); ((void)__h); @@ -1284,7 +1285,7 @@ public: _LIBCPP_INLINE_VISIBILITY iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) { - _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, + _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this, "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" " referring to this unordered_map"); ((void)__h); @@ -1692,7 +1693,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( { _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1712,7 +1713,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( } #if _LIBCPP_DEBUG_LEVEL == 2 else - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -2468,7 +2469,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( { _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -2489,7 +2490,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( } #if _LIBCPP_DEBUG_LEVEL == 2 else - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index ad58fda24f..29a19f2f0c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -463,6 +463,7 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__debug> #include <__functional/is_transparent.h> #include <__hash_table> +#include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> #include <compare> @@ -640,7 +641,7 @@ public: #if _LIBCPP_DEBUG_LEVEL == 2 iterator emplace_hint(const_iterator __p, _Args&&... __args) { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not" " referring to this unordered_set"); return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first; @@ -657,7 +658,7 @@ public: #if _LIBCPP_DEBUG_LEVEL == 2 iterator insert(const_iterator __p, value_type&& __x) { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" " referring to this unordered_set"); return insert(_VSTD::move(__x)).first; @@ -678,7 +679,7 @@ public: #if _LIBCPP_DEBUG_LEVEL == 2 iterator insert(const_iterator __p, const value_type& __x) { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" " referring to this unordered_set"); return insert(__x).first; @@ -1019,7 +1020,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( { _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1037,7 +1038,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( } #if _LIBCPP_DEBUG_LEVEL == 2 else - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1660,7 +1661,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( { _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } @@ -1678,7 +1679,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( } #if _LIBCPP_DEBUG_LEVEL == 2 else - __get_db()->swap(this, &__u); + __get_db()->swap(this, _VSTD::addressof(__u)); #endif } diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index e4e74633d0..c1f3af32cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -128,7 +128,7 @@ __cpp_lib_null_iterators 201304L <iterator> __cpp_lib_optional 201606L <optional> __cpp_lib_out_ptr 202106L <memory> __cpp_lib_parallel_algorithm 201603L <algorithm> <numeric> -__cpp_lib_polymorphic_allocator 201902L <memory> +__cpp_lib_polymorphic_allocator 201902L <memory_resource> __cpp_lib_quoted_string_io 201304L <iomanip> __cpp_lib_ranges 201811L <algorithm> <functional> <iterator> <memory> <ranges> |