diff options
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include')
491 files changed, 6747 insertions, 4949 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/adjacent_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/adjacent_find.h index 6f15456e3a4..f0708ebe251 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/adjacent_find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/adjacent_find.h @@ -26,7 +26,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _Iter, class _Sent, class _BinaryPredicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { if (__first == __last) return __first; @@ -40,13 +40,13 @@ __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { } template <class _ForwardIterator, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { return std::__adjacent_find(std::move(__first), std::move(__last), __pred); } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { return std::adjacent_find(std::move(__first), std::move(__last), __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/all_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/all_of.h index ec84eea7592..1fcb74ffc0f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/all_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/all_of.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/any_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/any_of.h index b5ff778c417..acb546bb22d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/any_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/any_of.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h index 6065fc37274..79a5ec089f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h @@ -22,14 +22,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { __first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp); return __first != __last && !__comp(__value, *__first); } template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { return std::binary_search(__first, __last, __value, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp.h index a0fa88d6d2a..1f38f5d2d99 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp.h @@ -11,6 +11,7 @@ #include <__config> #include <__type_traits/desugars_to.h> +#include <__type_traits/is_integral.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -42,7 +43,7 @@ struct __less<void, void> { }; template <class _Tp> -inline const bool __desugars_to_v<__less_tag, __less<>, _Tp, _Tp> = true; +inline const bool __desugars_to_v<__totally_ordered_less_tag, __less<>, _Tp, _Tp> = is_integral<_Tp>::value; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h index 0890b895f54..7ae47514d6d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h @@ -14,8 +14,10 @@ #include <__algorithm/iterator_operations.h> #include <__algorithm/min.h> #include <__config> +#include <__iterator/iterator_traits.h> #include <__iterator/segmented_iterator.h> #include <__type_traits/common_type.h> +#include <__type_traits/enable_if.h> #include <__utility/move.h> #include <__utility/pair.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_backward.h index 73dc846a975..48a768f577f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy_backward.h @@ -13,8 +13,10 @@ #include <__algorithm/iterator_operations.h> #include <__algorithm/min.h> #include <__config> +#include <__iterator/iterator_traits.h> #include <__iterator/segmented_iterator.h> #include <__type_traits/common_type.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_constructible.h> #include <__utility/move.h> #include <__utility/pair.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/count.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/count.h index 1cfe7f631ac..6910b4f43e9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/count.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/count.h @@ -16,9 +16,10 @@ #include <__bit/popcount.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__fwd/bit_reference.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -79,7 +80,7 @@ __count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __l } template <class _InputIterator, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __iter_diff_t<_InputIterator> count(_InputIterator __first, _InputIterator __last, const _Tp& __value) { __identity __proj; return std::__count<_ClassicAlgPolicy>(__first, __last, __value, __proj); diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/count_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/count_if.h index 25782069d03..e7023889609 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/count_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/count_if.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::difference_type count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { typename iterator_traits<_InputIterator>::difference_type __r(0); diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h index bfc8f72f6eb..cd8b0673e7a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal.h @@ -14,12 +14,12 @@ #include <__algorithm/unwrap_iter.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__string/constexpr_c_functions.h> #include <__type_traits/desugars_to.h> #include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_equality_comparable.h> #include <__type_traits/is_volatile.h> @@ -35,7 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl( _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate& __pred) { for (; __first1 != __last1; ++__first1, (void)++__first2) if (!__pred(*__first1, *__first2)) @@ -49,20 +49,20 @@ template <class _Tp, __enable_if_t<__desugars_to_v<__equal_tag, _BinaryPredicate, _Tp, _Up> && !is_volatile<_Tp>::value && !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&) { return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1)); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { return std::__equal_iter_impl( std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred); } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { return std::equal(__first1, __last1, __first2, __equal_to()); } @@ -70,7 +70,7 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first #if _LIBCPP_STD_VER >= 14 template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl( _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) { while (__first1 != __last1 && __first2 != __last2) { if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) @@ -90,13 +90,13 @@ template <class _Tp, __is_identity<_Proj2>::value && !is_volatile<_Tp>::value && !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&, _Proj2&) { return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1)); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, @@ -119,7 +119,7 @@ equal(_InputIterator1 __first1, } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::equal(__first1, __last1, __first2, __last2, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h index 09bbf8f0060..4e74ad20aa4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h @@ -17,11 +17,11 @@ #include <__algorithm/upper_bound.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__type_traits/is_constructible.h> #include <__utility/move.h> @@ -60,9 +60,9 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp } template <class _ForwardIterator, class _Tp, class _Compare> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { - static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable"); + static_assert(__is_callable<_Compare&, decltype(*__first), const _Tp&>::value, "The comparator has to be callable"); static_assert(is_copy_constructible<_ForwardIterator>::value, "Iterator has to be copy constructible"); return std::__equal_range<_ClassicAlgPolicy>( std::move(__first), @@ -73,7 +73,7 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu } template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { return std::equal_range(std::move(__first), std::move(__last), __value, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h index 7f58dbb13a5..6f23ec3f6fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find.h @@ -17,10 +17,12 @@ #include <__bit/invert_if.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__fwd/bit_reference.h> #include <__iterator/segmented_iterator.h> #include <__string/constexpr_c_functions.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> +#include <__type_traits/is_equality_comparable.h> #include <__type_traits/is_integral.h> #include <__type_traits/is_same.h> #include <__type_traits/is_signed.h> @@ -167,7 +169,7 @@ struct __find_segment { // public API template <class _InputIterator, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp& __value) { __identity __proj; return std::__rewrap_iter( diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h index 7e08e795353..08d1a295f8e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_end.h @@ -15,11 +15,11 @@ #include <__algorithm/search.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> #include <__iterator/reverse_iterator.h> +#include <__type_traits/invoke.h> #include <__utility/pair.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -80,111 +80,8 @@ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> } } -template < class _IterOps, - class _Pred, - class _Iter1, - class _Sent1, - class _Iter2, - class _Sent2, - class _Proj1, - class _Proj2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end( - _Iter1 __first1, - _Sent1 __sent1, - _Iter2 __first2, - _Sent2 __sent2, - _Pred& __pred, - _Proj1& __proj1, - _Proj2& __proj2, - bidirectional_iterator_tag, - bidirectional_iterator_tag) { - auto __last1 = _IterOps::next(__first1, __sent1); - auto __last2 = _IterOps::next(__first2, __sent2); - // modeled after search algorithm (in reverse) - if (__first2 == __last2) - return __last1; // Everything matches an empty sequence - _Iter1 __l1 = __last1; - _Iter2 __l2 = __last2; - --__l2; - while (true) { - // Find last element in sequence 1 that matchs *(__last2-1), with a mininum of loop checks - while (true) { - if (__first1 == __l1) // return __last1 if no element matches *__first2 - return __last1; - if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2))) - break; - } - // *__l1 matches *__l2, now match elements before here - _Iter1 __m1 = __l1; - _Iter2 __m2 = __l2; - while (true) { - if (__m2 == __first2) // If pattern exhausted, __m1 is the answer (works for 1 element pattern) - return __m1; - if (__m1 == __first1) // Otherwise if source exhaused, pattern not found - return __last1; - - // if there is a mismatch, restart with a new __l1 - if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(__proj2, *--__m2))) { - break; - } // else there is a match, check next elements - } - } -} - -template < class _AlgPolicy, - class _Pred, - class _Iter1, - class _Sent1, - class _Iter2, - class _Sent2, - class _Proj1, - class _Proj2> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end( - _Iter1 __first1, - _Sent1 __sent1, - _Iter2 __first2, - _Sent2 __sent2, - _Pred& __pred, - _Proj1& __proj1, - _Proj2& __proj2, - random_access_iterator_tag, - random_access_iterator_tag) { - typedef typename iterator_traits<_Iter1>::difference_type _D1; - auto __last1 = _IterOps<_AlgPolicy>::next(__first1, __sent1); - auto __last2 = _IterOps<_AlgPolicy>::next(__first2, __sent2); - // Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern - auto __len2 = __last2 - __first2; - if (__len2 == 0) - return __last1; - auto __len1 = __last1 - __first1; - if (__len1 < __len2) - return __last1; - const _Iter1 __s = __first1 + _D1(__len2 - 1); // End of pattern match can't go before here - _Iter1 __l1 = __last1; - _Iter2 __l2 = __last2; - --__l2; - while (true) { - while (true) { - if (__s == __l1) - return __last1; - if (std::__invoke(__pred, std::__invoke(__proj1, *--__l1), std::__invoke(__proj2, *__l2))) - break; - } - _Iter1 __m1 = __l1; - _Iter2 __m2 = __l2; - while (true) { - if (__m2 == __first2) - return __m1; - // no need to check range on __m1 because __s guarantees we have enough source - if (!std::__invoke(__pred, std::__invoke(__proj1, *--__m1), std::__invoke(*--__m2))) { - break; - } - } - } -} - template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_end_classic( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, @@ -205,7 +102,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Fo } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, @@ -215,7 +112,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Fo } template <class _ForwardIterator1, class _ForwardIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { return std::find_end(__first1, __last1, __first2, __last2, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_first_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_first_of.h index 6b99f562f88..4a240f73317 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_first_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_first_of.h @@ -35,7 +35,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_fir } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, @@ -45,7 +45,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Fo } template <class _ForwardIterator1, class _ForwardIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if.h index 22092d352b0..fd63bcc3a50 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if_not.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if_not.h index cc2001967f0..b4441b297c4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if_not.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/find_if_not.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h index 255658f5232..1bcb3be9aad 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/fold.h @@ -11,6 +11,7 @@ #define _LIBCPP___ALGORITHM_FOLD_H #include <__concepts/assignable.h> +#include <__concepts/constructible.h> #include <__concepts/convertible_to.h> #include <__concepts/invocable.h> #include <__concepts/movable.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h index 62af03c3742..a86102fc6d4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/includes.h @@ -13,8 +13,8 @@ #include <__algorithm/comp_ref_type.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/move.h> @@ -47,14 +47,14 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __includes( } template <class _InputIterator1, class _InputIterator2, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { static_assert( - __is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value, "Comparator has to be callable"); + __is_callable<_Compare&, decltype(*__first1), decltype(*__first2)>::value, "The comparator has to be callable"); return std::__includes( std::move(__first1), @@ -67,7 +67,7 @@ includes(_InputIterator1 __first1, } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::includes(std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h index a6bcc66a2fa..62a8bc53e23 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h @@ -24,8 +24,9 @@ #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> #include <__memory/destruct_n.h> -#include <__memory/temporary_buffer.h> #include <__memory/unique_ptr.h> +#include <__memory/unique_temporary_buffer.h> +#include <__utility/move.h> #include <__utility/pair.h> #include <new> @@ -208,16 +209,19 @@ _LIBCPP_HIDE_FROM_ABI void __inplace_merge( _BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare&& __comp) { typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; - difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle); - difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last); - difference_type __buf_size = std::min(__len1, __len2); - // TODO: Remove the use of std::get_temporary_buffer - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - pair<value_type*, ptrdiff_t> __buf = std::get_temporary_buffer<value_type>(__buf_size); - _LIBCPP_SUPPRESS_DEPRECATED_POP - unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first); + difference_type __len1 = _IterOps<_AlgPolicy>::distance(__first, __middle); + difference_type __len2 = _IterOps<_AlgPolicy>::distance(__middle, __last); + difference_type __buf_size = std::min(__len1, __len2); + __unique_temporary_buffer<value_type> __unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__buf_size); return std::__inplace_merge<_AlgPolicy>( - std::move(__first), std::move(__middle), std::move(__last), __comp, __len1, __len2, __buf.first, __buf.second); + std::move(__first), + std::move(__middle), + std::move(__last), + __comp, + __len1, + __len2, + __unique_buf.get(), + __unique_buf.get_deleter().__count_); } template <class _BidirectionalIterator, class _Compare> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap.h index c589b804a5d..fa668c1d043 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap.h @@ -22,13 +22,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _RandomAccessIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last; } template <class _RandomAccessIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::is_heap(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap_until.h index a174f2453cf..7444d978e37 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_heap_until.h @@ -46,13 +46,13 @@ __is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co } template <class _RandomAccessIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)); } template <class _RandomAccessIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::__is_heap_until(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_partitioned.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_partitioned.h index 1f7c8b0b267..700e452bbfa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_partitioned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_partitioned.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_permutation.h index 2ddfb32a212..8753e9fc13f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_permutation.h @@ -14,12 +14,14 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/concepts.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> +#include <__type_traits/is_same.h> #include <__utility/move.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -113,7 +115,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl( // 2+1 iterators, predicate. Not used by range algorithms. template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation( +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation( _ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _BinaryPredicate&& __pred) { // Shorten sequences as much as possible by lopping of any equal prefix. for (; __first1 != __last1; ++__first1, (void)++__first2) { @@ -247,17 +249,17 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation( // 2+1 iterators, predicate template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) { - static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, - "The predicate has to be callable"); + static_assert(__is_callable<_BinaryPredicate&, decltype(*__first1), decltype(*__first2)>::value, + "The comparator has to be callable"); return std::__is_permutation<_ClassicAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2), __pred); } // 2+1 iterators template <class _ForwardIterator1, class _ForwardIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { return std::is_permutation(__first1, __last1, __first2, __equal_to()); } @@ -266,7 +268,7 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIt // 2+2 iterators template <class _ForwardIterator1, class _ForwardIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { return std::__is_permutation<_ClassicAlgPolicy>( std::move(__first1), @@ -280,14 +282,14 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 boo // 2+2 iterators, predicate template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { - static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, - "The predicate has to be callable"); + static_assert(__is_callable<_BinaryPredicate&, decltype(*__first1), decltype(*__first2)>::value, + "The comparator has to be callable"); return std::__is_permutation<_ClassicAlgPolicy>( std::move(__first1), diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted.h index 3befb1ac9c2..ff61a736041 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted.h @@ -22,13 +22,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last; } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) { return std::is_sorted(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted_until.h index 53a49f00de3..b64fb65e84e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted_until.h @@ -35,13 +35,13 @@ __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __ } template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { return std::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp); } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) { return std::is_sorted_until(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h index 5cf13f0a3f2..8ced989233b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h @@ -11,6 +11,7 @@ #include <__algorithm/iter_swap.h> #include <__algorithm/ranges_iterator_concept.h> +#include <__assert> #include <__config> #include <__iterator/advance.h> #include <__iterator/distance.h> @@ -160,6 +161,59 @@ struct _IterOps<_ClassicAlgPolicy> { _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 void __advance_to(_Iter& __first, _Iter __last) { __first = __last; } + + // advance with sentinel, a la std::ranges::advance + template <class _Iter> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_Iter> + __advance_to(_Iter& __iter, __difference_type<_Iter> __count, const _Iter& __sentinel) { + return _IterOps::__advance_to(__iter, __count, __sentinel, typename iterator_traits<_Iter>::iterator_category()); + } + +private: + // advance with sentinel, a la std::ranges::advance -- InputIterator specialization + template <class _InputIter> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_InputIter> __advance_to( + _InputIter& __iter, __difference_type<_InputIter> __count, const _InputIter& __sentinel, input_iterator_tag) { + __difference_type<_InputIter> __dist = 0; + for (; __dist < __count && __iter != __sentinel; ++__dist) + ++__iter; + return __count - __dist; + } + + // advance with sentinel, a la std::ranges::advance -- BidirectionalIterator specialization + template <class _BiDirIter> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_BiDirIter> + __advance_to(_BiDirIter& __iter, + __difference_type<_BiDirIter> __count, + const _BiDirIter& __sentinel, + bidirectional_iterator_tag) { + __difference_type<_BiDirIter> __dist = 0; + if (__count >= 0) + for (; __dist < __count && __iter != __sentinel; ++__dist) + ++__iter; + else + for (__count = -__count; __dist < __count && __iter != __sentinel; ++__dist) + --__iter; + return __count - __dist; + } + + // advance with sentinel, a la std::ranges::advance -- RandomIterator specialization + template <class _RandIter> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __difference_type<_RandIter> + __advance_to(_RandIter& __iter, + __difference_type<_RandIter> __count, + const _RandIter& __sentinel, + random_access_iterator_tag) { + auto __dist = _IterOps::distance(__iter, __sentinel); + _LIBCPP_ASSERT_VALID_INPUT_RANGE( + __count == 0 || (__dist < 0) == (__count < 0), "__sentinel must precede __iter when __count < 0"); + if (__count < 0) + __dist = __dist > __count ? __dist : __count; + else + __dist = __dist < __count ? __dist : __count; + __iter += __dist; + return __count - __dist; + } }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lexicographical_compare.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lexicographical_compare.h index edc29e269c8..1de3ca13e1b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lexicographical_compare.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lexicographical_compare.h @@ -10,48 +10,120 @@ #define _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H #include <__algorithm/comp.h> -#include <__algorithm/comp_ref_type.h> +#include <__algorithm/min.h> +#include <__algorithm/mismatch.h> +#include <__algorithm/simd_utils.h> +#include <__algorithm/unwrap_iter.h> #include <__config> +#include <__functional/identity.h> #include <__iterator/iterator_traits.h> +#include <__string/constexpr_c_functions.h> +#include <__type_traits/desugars_to.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> +#include <__type_traits/is_equality_comparable.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_trivially_lexicographically_comparable.h> +#include <__type_traits/is_volatile.h> + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include <cwchar> +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Compare, class _InputIterator1, class _InputIterator2> +template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __lexicographical_compare( - _InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _Compare __comp) { - for (; __first2 != __last2; ++__first1, (void)++__first2) { - if (__first1 == __last1 || __comp(*__first1, *__first2)) + _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { + while (__first2 != __last2) { + if (__first1 == __last1 || + std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) return true; - if (__comp(*__first2, *__first1)) + if (std::__invoke(__comp, std::__invoke(__proj2, *__first2), std::__invoke(__proj1, *__first1))) return false; + ++__first1; + ++__first2; } return false; } +#if _LIBCPP_STD_VER >= 14 + +// If the comparison operation is equivalent to < and that is a total order, we know that we can use equality comparison +// on that type instead to extract some information. Furthermore, if equality comparison on that type is trivial, the +// user can't observe that we're calling it. So instead of using the user-provided total order, we use std::mismatch, +// which uses equality comparison (and is vertorized). Additionally, if the type is trivially lexicographically +// comparable, we can go one step further and use std::memcmp directly instead of calling std::mismatch. +template <class _Tp, + class _Proj1, + class _Proj2, + class _Comp, + __enable_if_t<__desugars_to_v<__totally_ordered_less_tag, _Comp, _Tp, _Tp> && !is_volatile<_Tp>::value && + __libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value && + __is_identity<_Proj1>::value && __is_identity<_Proj2>::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +__lexicographical_compare(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __last2, _Comp&, _Proj1&, _Proj2&) { + if constexpr (__is_trivially_lexicographically_comparable_v<_Tp, _Tp>) { + auto __res = + std::__constexpr_memcmp(__first1, __first2, __element_count(std::min(__last1 - __first1, __last2 - __first2))); + if (__res == 0) + return __last1 - __first1 < __last2 - __first2; + return __res < 0; + } +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + else if constexpr (is_same<__remove_cv_t<_Tp>, wchar_t>::value) { + auto __res = std::__constexpr_wmemcmp(__first1, __first2, std::min(__last1 - __first1, __last2 - __first2)); + if (__res == 0) + return __last1 - __first1 < __last2 - __first2; + return __res < 0; + } +# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + else { + auto __res = std::mismatch(__first1, __last1, __first2, __last2); + if (__res.second == __last2) + return false; + if (__res.first == __last1) + return true; + return *__res.first < *__res.second; + } +} + +#endif // _LIBCPP_STD_VER >= 14 + template <class _InputIterator1, class _InputIterator2, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare( _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { - return std::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp); + __identity __proj; + return std::__lexicographical_compare( + std::__unwrap_iter(__first1), + std::__unwrap_iter(__last1), + std::__unwrap_iter(__first2), + std::__unwrap_iter(__last2), + __comp, + __proj, + __proj); } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool lexicographical_compare( _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::lexicographical_compare(__first1, __last1, __first2, __last2, __less<>()); } _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h index 8fd355a7cfc..2144ba96296 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h @@ -14,10 +14,10 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__type_traits/remove_reference.h> @@ -27,11 +27,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter -__lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { - auto __len = _IterOps<_AlgPolicy>::distance(__first, __last); - +template <class _AlgPolicy, class _Iter, class _Type, class _Proj, class _Comp> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter __lower_bound_bisecting( + _Iter __first, + const _Type& __value, + typename iterator_traits<_Iter>::difference_type __len, + _Comp& __comp, + _Proj& __proj) { while (__len != 0) { auto __l2 = std::__half_positive(__len); _Iter __m = __first; @@ -46,16 +48,58 @@ __lower_bound(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, return __first; } +// One-sided binary search, aka meta binary search, has been in the public domain for decades, and has the general +// advantage of being \Omega(1) rather than the classic algorithm's \Omega(log(n)), with the downside of executing at +// most 2*log(n) comparisons vs the classic algorithm's exact log(n). There are two scenarios in which it really shines: +// the first one is when operating over non-random-access iterators, because the classic algorithm requires knowing the +// container's size upfront, which adds \Omega(n) iterator increments to the complexity. The second one is when you're +// traversing the container in order, trying to fast-forward to the next value: in that case, the classic algorithm +// would yield \Omega(n*log(n)) comparisons and, for non-random-access iterators, \Omega(n^2) iterator increments, +// whereas the one-sided version will yield O(n) operations on both counts, with a \Omega(log(n)) bound on the number of +// comparisons. +template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Proj, class _Comp> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +__lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { + // step = 0, ensuring we can always short-circuit when distance is 1 later on + if (__first == __last || !std::__invoke(__comp, std::__invoke(__proj, *__first), __value)) + return __first; + + using _Distance = typename iterator_traits<_ForwardIterator>::difference_type; + for (_Distance __step = 1; __first != __last; __step <<= 1) { + auto __it = __first; + auto __dist = __step - _IterOps<_AlgPolicy>::__advance_to(__it, __step, __last); + // once we reach the last range where needle can be we must start + // looking inwards, bisecting that range + if (__it == __last || !std::__invoke(__comp, std::__invoke(__proj, *__it), __value)) { + // we've already checked the previous value and it was less, we can save + // one comparison by skipping bisection + if (__dist == 1) + return __it; + return std::__lower_bound_bisecting<_AlgPolicy>(__first, __value, __dist, __comp, __proj); + } + // range not found, move forward! + __first = __it; + } + return __first; +} + +template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Proj, class _Comp> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +__lower_bound(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { + const auto __dist = _IterOps<_AlgPolicy>::distance(__first, __last); + return std::__lower_bound_bisecting<_AlgPolicy>(__first, __value, __dist, __comp, __proj); +} + template <class _ForwardIterator, class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { - static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value, "The comparator has to be callable"); + static_assert(__is_callable<_Compare&, decltype(*__first), const _Tp&>::value, "The comparator has to be callable"); auto __proj = std::__identity(); return std::__lower_bound<_ClassicAlgPolicy>(__first, __last, __value, __comp, __proj); } template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { return std::lower_bound(__first, __last, __value, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h index 5245e523f3d..22cceb4cb2f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h @@ -16,6 +16,7 @@ #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_member_pointer.h> #include <__type_traits/is_same.h> #include <__utility/declval.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/max.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/max.h index d4c99f6f364..1673e6be912 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/max.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/max.h @@ -25,13 +25,13 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__a, __b) ? __b : __a; } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return std::max(__a, __b, __less<>()); } @@ -39,13 +39,13 @@ max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t, _Compare __comp) { return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) { return *std::max_element(__t.begin(), __t.end(), __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/max_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/max_element.h index c036726cbcc..929f337fc10 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/max_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/max_element.h @@ -13,6 +13,7 @@ #include <__algorithm/comp_ref_type.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_callable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -35,13 +36,15 @@ __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp } template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { + static_assert( + __is_callable<_Compare&, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable"); return std::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp); } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) { return std::max_element(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min.h index 1bafad8a461..660e0b204e1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min.h @@ -25,13 +25,13 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? __b : __a; } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return std::min(__a, __b, __less<>()); } @@ -39,13 +39,13 @@ min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t, _Compare __comp) { return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) { return *std::min_element(__t.begin(), __t.end(), __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h index 65f3594d630..db996365bf1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/min_element.h @@ -13,8 +13,8 @@ #include <__algorithm/comp_ref_type.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/move.h> @@ -48,18 +48,18 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter __min_element(_Iter __ } template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { static_assert( __has_forward_iterator_category<_ForwardIterator>::value, "std::min_element requires a ForwardIterator"); static_assert( - __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable"); + __is_callable<_Compare&, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable"); return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp); } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last) { return std::min_element(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax.h index 9feda2b4c0d..de0bec0ef72 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax.h @@ -24,13 +24,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b); } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return std::minmax(__a, __b, __less<>()); } @@ -38,16 +38,16 @@ minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __ #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) { - static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable"); + static_assert(__is_callable<_Compare&, _Tp, _Tp>::value, "The comparator has to be callable"); __identity __proj; auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj); return pair<_Tp, _Tp>(*__ret.first, *__ret.second); } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t) { return std::minmax(__t, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax_element.h index 43cb23347c3..dc0c3a818cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/minmax_element.h @@ -12,8 +12,8 @@ #include <__algorithm/comp.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/pair.h> @@ -79,18 +79,18 @@ __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) } template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { static_assert( __has_forward_iterator_category<_ForwardIterator>::value, "std::minmax_element requires a ForwardIterator"); static_assert( - __is_callable<_Compare, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable"); + __is_callable<_Compare&, decltype(*__first), decltype(*__first)>::value, "The comparator has to be callable"); auto __proj = __identity(); return std::__minmax_element_impl(__first, __last, __comp, __proj); } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) { return std::minmax_element(__first, __last, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/mismatch.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/mismatch.h index 632bec02406..cb83347584b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/mismatch.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/mismatch.h @@ -17,7 +17,9 @@ #include <__config> #include <__functional/identity.h> #include <__iterator/aliasing_iterator.h> +#include <__iterator/iterator_traits.h> #include <__type_traits/desugars_to.h> +#include <__type_traits/enable_if.h> #include <__type_traits/invoke.h> #include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_equality_comparable.h> @@ -37,7 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _Iter1, class _Sent1, class _Iter2, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> __mismatch_loop(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { while (__first1 != __last1) { if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) @@ -49,7 +51,7 @@ __mismatch_loop(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, } template <class _Iter1, class _Sent1, class _Iter2, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> __mismatch(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { return std::__mismatch_loop(__first1, __last1, __first2, __pred, __proj1, __proj2); } @@ -57,7 +59,7 @@ __mismatch(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Pred& __pred, _Pro #if _LIBCPP_VECTORIZE_ALGORITHMS template <class _Iter> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter> __mismatch_vectorized(_Iter __first1, _Iter __last1, _Iter __first2) { using __value_type = __iter_value_type<_Iter>; constexpr size_t __unroll_count = 4; @@ -124,7 +126,7 @@ template <class _Tp, __enable_if_t<is_integral<_Tp>::value && __desugars_to_v<__equal_tag, _Pred, _Tp, _Tp> && __is_identity<_Proj1>::value && __is_identity<_Proj2>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> __mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Pred&, _Proj1&, _Proj2&) { return std::__mismatch_vectorized(__first1, __last1, __first2); } @@ -137,7 +139,7 @@ template <class _Tp, __is_identity<_Proj1>::value && __is_identity<_Proj2>::value && __can_map_to_integer_v<_Tp> && __libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> __mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { if (__libcpp_is_constant_evaluated()) { return std::__mismatch_loop(__first1, __last1, __first2, __pred, __proj1, __proj2); @@ -150,7 +152,7 @@ __mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Pred& __pred, _Proj1& __ #endif // _LIBCPP_VECTORIZE_ALGORITHMS template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { __identity __proj; auto __res = std::__mismatch( @@ -159,14 +161,14 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { return std::mismatch(__first1, __last1, __first2, __equal_to()); } #if _LIBCPP_STD_VER >= 14 template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> __mismatch( +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> __mismatch( _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { while (__first1 != __last1 && __first2 != __last2) { if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) @@ -178,14 +180,14 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter } template <class _Tp, class _Pred, class _Proj1, class _Proj2> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> __mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { auto __len = std::min(__last1 - __first1, __last2 - __first2); return std::__mismatch(__first1, __first1 + __len, __first2, __pred, __proj1, __proj2); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, @@ -204,7 +206,7 @@ mismatch(_InputIterator1 __first1, } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::mismatch(__first1, __last1, __first2, __last2, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/move.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/move.h index 1716d43e2a6..005099dcac0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/move.h @@ -14,8 +14,10 @@ #include <__algorithm/iterator_operations.h> #include <__algorithm/min.h> #include <__config> +#include <__iterator/iterator_traits.h> #include <__iterator/segmented_iterator.h> #include <__type_traits/common_type.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_constructible.h> #include <__utility/move.h> #include <__utility/pair.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/move_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/move_backward.h index 4beb7bdbaac..24a8d9b2452 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/move_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/move_backward.h @@ -13,8 +13,10 @@ #include <__algorithm/iterator_operations.h> #include <__algorithm/min.h> #include <__config> +#include <__iterator/iterator_traits.h> #include <__iterator/segmented_iterator.h> #include <__type_traits/common_type.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_constructible.h> #include <__utility/move.h> #include <__utility/pair.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/none_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/none_of.h index 50841ba17cc..e6bd1976222 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/none_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/none_of.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator, class _Predicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h index ef7c9d34d94..172f53b290d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h @@ -18,8 +18,8 @@ #include <__algorithm/sort_heap.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -76,8 +76,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) { - static_assert( - __is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value, "Comparator has to be callable"); + static_assert(__is_callable<_Compare&, decltype(*__first), decltype(*__result_first)>::value, + "The comparator has to be callable"); auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>( __first, diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h index 824e49b9ec2..669aac3b275 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition.h @@ -12,6 +12,7 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -29,7 +30,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _Forw __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag) { while (true) { if (__first == __last) - return std::make_pair(std::move(__first), std::move(__first)); + return std::make_pair(__first, __first); if (!__pred(*__first)) break; ++__first; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl.h index 0bb052b3f97..71e7f28476e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pstl.h @@ -352,7 +352,7 @@ template <class _ExecutionPolicy, class _Predicate, class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>, enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_partitioned(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_partitioned requires ForwardIterators"); using _Implementation = __pstl::__dispatch<__pstl::__is_partitioned, __pstl::__current_configuration, _RawPolicy>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h index 3c54f723310..0f2cb666993 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __adjacent_find { -struct __fn { +struct __adjacent_find { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __adjacent_find_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { @@ -67,10 +66,9 @@ struct __fn { return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __adjacent_find inline namespace __cpo { -inline constexpr auto adjacent_find = __adjacent_find::__fn{}; +inline constexpr auto adjacent_find = __adjacent_find{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h index 2f603b32f32..fea08949381 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __all_of { -struct __fn { +struct __all_of { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { for (; __first != __last; ++__first) { @@ -58,10 +57,9 @@ struct __fn { return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __all_of inline namespace __cpo { -inline constexpr auto all_of = __all_of::__fn{}; +inline constexpr auto all_of = __all_of{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h index 205fcecc086..34d23b4b745 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __any_of { -struct __fn { +struct __any_of { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { for (; __first != __last; ++__first) { @@ -58,10 +57,9 @@ struct __fn { return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __any_of inline namespace __cpo { -inline constexpr auto any_of = __any_of::__fn{}; +inline constexpr auto any_of = __any_of{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h index 1ef2bd62b59..47bd0997334 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __binary_search { -struct __fn { +struct __binary_search { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, @@ -57,10 +56,9 @@ struct __fn { return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret)); } }; -} // namespace __binary_search inline namespace __cpo { -inline constexpr auto binary_search = __binary_search::__fn{}; +inline constexpr auto binary_search = __binary_search{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h index e6181ef9435..4bb3e46e73b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_clamp.h @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __clamp { -struct __fn { +struct __clamp { template <class _Type, class _Proj = identity, indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> @@ -50,10 +49,9 @@ struct __fn { return __value; } }; -} // namespace __clamp inline namespace __cpo { -inline constexpr auto clamp = __clamp::__fn{}; +inline constexpr auto clamp = __clamp{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h index 4836c3baed1..88de215297e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains.h @@ -33,8 +33,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __contains { -struct __fn { +struct __contains { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static @@ -50,10 +49,9 @@ struct __fn { ranges::end(__range); } }; -} // namespace __contains inline namespace __cpo { -inline constexpr auto contains = __contains::__fn{}; +inline constexpr auto contains = __contains{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h index 4398c457fd0..e8740d69dbe 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_contains_subrange.h @@ -35,8 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __contains_subrange { -struct __fn { +struct __contains_subrange { template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1, forward_iterator _Iter2, @@ -81,10 +80,9 @@ struct __fn { return __ret.empty() == false; } }; -} // namespace __contains_subrange inline namespace __cpo { -inline constexpr auto contains_subrange = __contains_subrange::__fn{}; +inline constexpr auto contains_subrange = __contains_subrange{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h index e1d6d32f05f..05b61c0d5d4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h @@ -37,8 +37,7 @@ namespace ranges { template <class _InIter, class _OutIter> using copy_result = in_out_result<_InIter, _OutIter>; -namespace __copy { -struct __fn { +struct __copy { template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter> requires indirectly_copyable<_InIter, _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter> @@ -55,10 +54,9 @@ struct __fn { return {std::move(__ret.first), std::move(__ret.second)}; } }; -} // namespace __copy inline namespace __cpo { -inline constexpr auto copy = __copy::__fn{}; +inline constexpr auto copy = __copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h index 93e32604250..81d14e465f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h @@ -35,8 +35,7 @@ namespace ranges { template <class _Ip, class _Op> using copy_backward_result = in_out_result<_Ip, _Op>; -namespace __copy_backward { -struct __fn { +struct __copy_backward { template <bidirectional_iterator _InIter1, sentinel_for<_InIter1> _Sent1, bidirectional_iterator _InIter2> requires indirectly_copyable<_InIter1, _InIter2> _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2> @@ -53,10 +52,9 @@ struct __fn { return {std::move(__ret.first), std::move(__ret.second)}; } }; -} // namespace __copy_backward inline namespace __cpo { -inline constexpr auto copy_backward = __copy_backward::__fn{}; +inline constexpr auto copy_backward = __copy_backward{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h index 4b41d2154e7..1a08985fe35 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h @@ -36,8 +36,7 @@ namespace ranges { template <class _Ip, class _Op> using copy_if_result = in_out_result<_Ip, _Op>; -namespace __copy_if { -struct __fn { +struct __copy_if { template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI static constexpr copy_if_result<_InIter, _OutIter> __copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) { @@ -71,10 +70,9 @@ struct __fn { return __copy_if_impl(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj); } }; -} // namespace __copy_if inline namespace __cpo { -inline constexpr auto copy_if = __copy_if::__fn{}; +inline constexpr auto copy_if = __copy_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h index 4353fa99278..4407e07f5ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h @@ -37,8 +37,7 @@ namespace ranges { template <class _Ip, class _Op> using copy_n_result = in_out_result<_Ip, _Op>; -namespace __copy_n { -struct __fn { +struct __copy_n { template <class _InIter, class _DiffType, class _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter> __go(_InIter __first, _DiffType __n, _OutIter __result) { @@ -65,10 +64,9 @@ struct __fn { return __go(std::move(__first), __n, std::move(__result)); } }; -} // namespace __copy_n inline namespace __cpo { -inline constexpr auto copy_n = __copy_n::__fn{}; +inline constexpr auto copy_n = __copy_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h index 4f351174387..2b3969e7630 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h @@ -34,8 +34,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __count { -struct __fn { +struct __count { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> @@ -50,10 +49,9 @@ struct __fn { return std::__count<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __proj); } }; -} // namespace __count inline namespace __cpo { -inline constexpr auto count = __count::__fn{}; +inline constexpr auto count = __count{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h index 5f2396ff7d5..2663180242c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h @@ -44,8 +44,7 @@ __count_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { return __counter; } -namespace __count_if { -struct __fn { +struct __count_if { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, @@ -63,10 +62,9 @@ struct __fn { return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); } }; -} // namespace __count_if inline namespace __cpo { -inline constexpr auto count_if = __count_if::__fn{}; +inline constexpr auto count_if = __count_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h index 06efdef36b7..3621bda3891 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_ends_with.h @@ -22,6 +22,7 @@ #include <__iterator/reverse_iterator.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__ranges/size.h> #include <__utility/move.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -36,8 +37,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __ends_with { -struct __fn { +struct __ends_with { template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> _LIBCPP_HIDE_FROM_ABI static constexpr bool __ends_with_fn_impl_bidirectional( _Iter1 __first1, @@ -185,10 +185,9 @@ struct __fn { } } }; -} // namespace __ends_with inline namespace __cpo { -inline constexpr auto ends_with = __ends_with::__fn{}; +inline constexpr auto ends_with = __ends_with{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h index edbd0e3641c..c26d13f0022 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h @@ -34,8 +34,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __equal { -struct __fn { +struct __equal { template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, input_iterator _Iter2, @@ -93,10 +92,9 @@ struct __fn { return false; } }; -} // namespace __equal inline namespace __cpo { -inline constexpr auto equal = __equal::__fn{}; +inline constexpr auto equal = __equal{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h index 4a308e016b5..cc765f19664 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal_range.h @@ -38,9 +38,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __equal_range { - -struct __fn { +struct __equal_range { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Tp, @@ -64,10 +62,8 @@ struct __fn { } }; -} // namespace __equal_range - inline namespace __cpo { -inline constexpr auto equal_range = __equal_range::__fn{}; +inline constexpr auto equal_range = __equal_range{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h index 7a177d85e9f..c248009f98f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h @@ -28,8 +28,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __fill { -struct __fn { +struct __fill { template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent> _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const { if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) { @@ -46,10 +45,9 @@ struct __fn { return (*this)(ranges::begin(__range), ranges::end(__range), __value); } }; -} // namespace __fill inline namespace __cpo { -inline constexpr auto fill = __fill::__fn{}; +inline constexpr auto fill = __fill{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h index a6e988c0089..7a33268e1dd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h @@ -25,8 +25,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __fill_n { -struct __fn { +struct __fill_n { template <class _Type, output_iterator<const _Type&> _Iter> _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, iter_difference_t<_Iter> __n, const _Type& __value) const { @@ -37,10 +36,9 @@ struct __fn { return __first; } }; -} // namespace __fill_n inline namespace __cpo { -inline constexpr auto fill_n = __fill_n::__fn{}; +inline constexpr auto fill_n = __fill_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h index 6b0d5efe37a..1eac4cfa02a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h @@ -36,8 +36,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __find { -struct __fn { +struct __find { template <class _Iter, class _Sent, class _Tp, class _Proj> _LIBCPP_HIDE_FROM_ABI static constexpr _Iter __find_unwrap(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) { @@ -64,10 +63,9 @@ struct __fn { return __find_unwrap(ranges::begin(__r), ranges::end(__r), __value, __proj); } }; -} // namespace __find inline namespace __cpo { -inline constexpr auto find = __find::__fn{}; +inline constexpr auto find = __find{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h index e49e66dd4ac..682724a48cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_end.h @@ -35,8 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __find_end { -struct __fn { +struct __find_end { template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1, forward_iterator _Iter2, @@ -87,10 +86,9 @@ struct __fn { return {__ret.first, __ret.second}; } }; -} // namespace __find_end inline namespace __cpo { -inline constexpr auto find_end = __find_end::__fn{}; +inline constexpr auto find_end = __find_end{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h index d92d9686bc4..102e16dd7a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __find_first_of { -struct __fn { +struct __find_first_of { template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter1 __find_first_of_impl( _Iter1 __first1, @@ -90,10 +89,9 @@ struct __fn { __proj2); } }; -} // namespace __find_first_of inline namespace __cpo { -inline constexpr auto find_first_of = __find_first_of::__fn{}; +inline constexpr auto find_first_of = __find_first_of{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h index 888f9ec3cb2..ed6406e6186 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h @@ -42,8 +42,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pre return __first; } -namespace __find_if { -struct __fn { +struct __find_if { template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, @@ -59,10 +58,9 @@ struct __fn { return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); } }; -} // namespace __find_if inline namespace __cpo { -inline constexpr auto find_if = __find_if::__fn{}; +inline constexpr auto find_if = __find_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h index ec19545b5a1..9a359b2afda 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h @@ -34,8 +34,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __find_if_not { -struct __fn { +struct __find_if_not { template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, @@ -53,10 +52,9 @@ struct __fn { return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj); } }; -} // namespace __find_if_not inline namespace __cpo { -inline constexpr auto find_if_not = __find_if_not::__fn{}; +inline constexpr auto find_if_not = __find_if_not{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_last.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_last.h new file mode 100644 index 00000000000..e7dae1704c2 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_last.h @@ -0,0 +1,170 @@ +//===----------------------------------------------------------------------===// +// +// 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_FIND_LAST_H +#define _LIBCPP___ALGORITHM_RANGES_FIND_LAST_H + +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/indirectly_comparable.h> +#include <__iterator/next.h> +#include <__iterator/prev.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/subrange.h> +#include <__utility/forward.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +#if _LIBCPP_STD_VER >= 23 + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { + +template <class _Iter, class _Sent, class _Pred, class _Proj> +_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> +__find_last_impl(_Iter __first, _Sent __last, _Pred __pred, _Proj& __proj) { + if (__first == __last) { + return subrange<_Iter>(__first, __first); + } + + if constexpr (bidirectional_iterator<_Iter>) { + auto __last_it = ranges::next(__first, __last); + for (auto __it = ranges::prev(__last_it); __it != __first; --__it) { + if (__pred(std::invoke(__proj, *__it))) { + return subrange<_Iter>(std::move(__it), std::move(__last_it)); + } + } + if (__pred(std::invoke(__proj, *__first))) { + return subrange<_Iter>(std::move(__first), std::move(__last_it)); + } + return subrange<_Iter>(__last_it, __last_it); + } else { + bool __found = false; + _Iter __found_it; + for (; __first != __last; ++__first) { + if (__pred(std::invoke(__proj, *__first))) { + __found = true; + __found_it = __first; + } + } + + if (__found) { + return subrange<_Iter>(std::move(__found_it), std::move(__first)); + } else { + return subrange<_Iter>(__first, __first); + } + } +} + +struct __find_last { + template <class _Type> + struct __op { + const _Type& __value; + template <class _Elem> + _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const { + return std::forward<_Elem>(__elem) == __value; + } + }; + + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> + operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) { + return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Type>{__value}, __proj); + } + + template <forward_range _Range, class _Type, class _Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range> + operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) { + return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Type>{__value}, __proj); + } +}; + +struct __find_last_if { + template <class _Pred> + struct __op { + _Pred& __pred; + template <class _Elem> + _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const { + return std::invoke(__pred, std::forward<_Elem>(__elem)); + } + }; + + template <forward_iterator _Iter, + sentinel_for<_Iter> _Sent, + class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> + operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) { + return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Pred>{__pred}, __proj); + } + + template <forward_range _Range, + class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range> + operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) { + return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Pred>{__pred}, __proj); + } +}; + +struct __find_last_if_not { + template <class _Pred> + struct __op { + _Pred& __pred; + template <class _Elem> + _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const { + return !std::invoke(__pred, std::forward<_Elem>(__elem)); + } + }; + + template <forward_iterator _Iter, + sentinel_for<_Iter> _Sent, + class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> + operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) { + return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Pred>{__pred}, __proj); + } + + template <forward_range _Range, + class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range> + operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) { + return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Pred>{__pred}, __proj); + } +}; + +inline namespace __cpo { +inline constexpr auto find_last = __find_last{}; +inline constexpr auto find_last_if = __find_last_if{}; +inline constexpr auto find_last_if_not = __find_last_if_not{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___ALGORITHM_RANGES_FIND_LAST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h index 225dc774c87..de39bc55227 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h @@ -36,8 +36,7 @@ namespace ranges { template <class _Iter, class _Func> using for_each_result = in_fun_result<_Iter, _Func>; -namespace __for_each { -struct __fn { +struct __for_each { private: template <class _Iter, class _Sent, class _Proj, class _Func> _LIBCPP_HIDE_FROM_ABI constexpr static for_each_result<_Iter, _Func> @@ -65,10 +64,9 @@ public: 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{}; +inline constexpr auto for_each = __for_each{}; } // namespace __cpo } // namespace ranges 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 index d1fdca34cc5..603cb723233 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h @@ -36,8 +36,7 @@ namespace ranges { template <class _Iter, class _Func> using for_each_n_result = in_fun_result<_Iter, _Func>; -namespace __for_each_n { -struct __fn { +struct __for_each_n { 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 { @@ -48,10 +47,9 @@ struct __fn { return {std::move(__first), std::move(__func)}; } }; -} // namespace __for_each_n inline namespace __cpo { -inline constexpr auto for_each_n = __for_each_n::__fn{}; +inline constexpr auto for_each_n = __for_each_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h index e6467198e6b..04333b358ee 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate.h @@ -12,12 +12,12 @@ #include <__concepts/constructible.h> #include <__concepts/invocable.h> #include <__config> -#include <__functional/invoke.h> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> +#include <__type_traits/invoke.h> #include <__utility/move.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -32,9 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __generate { - -struct __fn { +struct __generate { template <class _OutIter, class _Sent, class _Func> _LIBCPP_HIDE_FROM_ABI constexpr static _OutIter __generate_fn_impl(_OutIter __first, _Sent __last, _Func& __gen) { for (; __first != __last; ++__first) { @@ -57,10 +55,8 @@ struct __fn { } }; -} // namespace __generate - inline namespace __cpo { -inline constexpr auto generate = __generate::__fn{}; +inline constexpr auto generate = __generate{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h index cd5fd7483ab..a318994d0ea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_generate_n.h @@ -13,12 +13,12 @@ #include <__concepts/invocable.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__type_traits/invoke.h> #include <__utility/move.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -33,9 +33,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __generate_n { - -struct __fn { +struct __generate_n { template <input_or_output_iterator _OutIter, copy_constructible _Func> requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>> _LIBCPP_HIDE_FROM_ABI constexpr _OutIter @@ -49,10 +47,8 @@ struct __fn { } }; -} // namespace __generate_n - inline namespace __cpo { -inline constexpr auto generate_n = __generate_n::__fn{}; +inline constexpr auto generate_n = __generate_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h index c4c3b8ed088..9145f3b5564 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_includes.h @@ -35,9 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __includes { - -struct __fn { +struct __includes { template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, input_iterator _Iter2, @@ -82,10 +80,8 @@ struct __fn { } }; -} // namespace __includes - inline namespace __cpo { -inline constexpr auto includes = __includes::__fn{}; +inline constexpr auto includes = __includes{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h index d94c0ad4656..5879d0e7ef0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_inplace_merge.h @@ -39,9 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __inplace_merge { - -struct __fn { +struct __inplace_merge { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI static constexpr auto __inplace_merge_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp&& __comp, _Proj&& __proj) { @@ -68,10 +66,8 @@ struct __fn { } }; -} // namespace __inplace_merge - inline namespace __cpo { -inline constexpr auto inplace_merge = __inplace_merge::__fn{}; +inline constexpr auto inplace_merge = __inplace_merge{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h index 3d9e18ce1d9..b4724abfb62 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap.h @@ -34,9 +34,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __is_heap { - -struct __fn { +struct __is_heap { template <class _Iter, class _Sent, class _Proj, class _Comp> _LIBCPP_HIDE_FROM_ABI constexpr static bool __is_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -65,10 +63,8 @@ struct __fn { } }; -} // namespace __is_heap - inline namespace __cpo { -inline constexpr auto is_heap = __is_heap::__fn{}; +inline constexpr auto is_heap = __is_heap{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h index 7a2e1fc7705..25f3b484faa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_heap_until.h @@ -35,9 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __is_heap_until { - -struct __fn { +struct __is_heap_until { template <class _Iter, class _Sent, class _Proj, class _Comp> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __is_heap_until_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -65,10 +63,8 @@ struct __fn { } }; -} // namespace __is_heap_until - inline namespace __cpo { -inline constexpr auto is_heap_until = __is_heap_until::__fn{}; +inline constexpr auto is_heap_until = __is_heap_until{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h index 5be6fba46fd..8092abfcd1d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h @@ -31,8 +31,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __is_partitioned { -struct __fn { +struct __is_partitioned { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static bool __is_partitioned_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { @@ -70,10 +69,9 @@ struct __fn { return __is_partitioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __is_partitioned inline namespace __cpo { -inline constexpr auto is_partitioned = __is_partitioned::__fn{}; +inline constexpr auto is_partitioned = __is_partitioned{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h index 1f8d67007a5..53a431d2ba4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_permutation.h @@ -33,8 +33,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __is_permutation { -struct __fn { +struct __is_permutation { template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static bool __is_permutation_func_impl( _Iter1 __first1, @@ -91,10 +90,9 @@ struct __fn { __proj2); } }; -} // namespace __is_permutation inline namespace __cpo { -inline constexpr auto is_permutation = __is_permutation::__fn{}; +inline constexpr auto is_permutation = __is_permutation{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h index 5b88d422b4b..ab0670688a0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h @@ -31,8 +31,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __is_sorted { -struct __fn { +struct __is_sorted { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, @@ -51,10 +50,9 @@ struct __fn { return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last; } }; -} // namespace __is_sorted inline namespace __cpo { -inline constexpr auto is_sorted = __is_sorted::__fn{}; +inline constexpr auto is_sorted = __is_sorted{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h index 54de530c8b2..f2e51c264e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h @@ -47,8 +47,7 @@ __is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj return __i; } -namespace __is_sorted_until { -struct __fn { +struct __is_sorted_until { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, @@ -66,10 +65,9 @@ struct __fn { return ranges::__is_sorted_until_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj); } }; -} // namespace __is_sorted_until inline namespace __cpo { -inline constexpr auto is_sorted_until = __is_sorted_until::__fn{}; +inline constexpr auto is_sorted_until = __is_sorted_until{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h index 6d82017e302..ec12b0cc29a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lexicographical_compare.h @@ -9,6 +9,8 @@ #ifndef _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H #define _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H +#include <__algorithm/lexicographical_compare.h> +#include <__algorithm/unwrap_range.h> #include <__config> #include <__functional/identity.h> #include <__functional/invoke.h> @@ -31,10 +33,9 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __lexicographical_compare { -struct __fn { +struct __lexicographical_compare { template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp> - _LIBCPP_HIDE_FROM_ABI constexpr static bool __lexicographical_compare_impl( + static _LIBCPP_HIDE_FROM_ABI constexpr bool __lexicographical_compare_unwrap( _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, @@ -42,15 +43,16 @@ struct __fn { _Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { - while (__first2 != __last2) { - if (__first1 == __last1 || std::invoke(__comp, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) - return true; - if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) - return false; - ++__first1; - ++__first2; - } - return false; + auto [__first1_un, __last1_un] = std::__unwrap_range(std::move(__first1), std::move(__last1)); + auto [__first2_un, __last2_un] = std::__unwrap_range(std::move(__first2), std::move(__last2)); + return std::__lexicographical_compare( + std::move(__first1_un), + std::move(__last1_un), + std::move(__first2_un), + std::move(__last2_un), + __comp, + __proj1, + __proj2); } template <input_iterator _Iter1, @@ -68,7 +70,7 @@ struct __fn { _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { - return __lexicographical_compare_impl( + return __lexicographical_compare_unwrap( std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __comp, __proj1, __proj2); } @@ -80,7 +82,7 @@ struct __fn { _Comp = ranges::less> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()( _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { - return __lexicographical_compare_impl( + return __lexicographical_compare_unwrap( ranges::begin(__range1), ranges::end(__range1), ranges::begin(__range2), @@ -90,10 +92,9 @@ struct __fn { __proj2); } }; -} // namespace __lexicographical_compare inline namespace __cpo { -inline constexpr auto lexicographical_compare = __lexicographical_compare::__fn{}; +inline constexpr auto lexicographical_compare = __lexicographical_compare{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h index 0651147e042..d1b332849b8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h @@ -36,8 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __lower_bound { -struct __fn { +struct __lower_bound { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, @@ -57,10 +56,9 @@ struct __fn { return std::__lower_bound<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj); } }; -} // namespace __lower_bound inline namespace __cpo { -inline constexpr auto lower_bound = __lower_bound::__fn{}; +inline constexpr auto lower_bound = __lower_bound{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h index fe9c024fbf8..97148f77b41 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_make_heap.h @@ -40,9 +40,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __make_heap { - -struct __fn { +struct __make_heap { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __make_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -69,10 +67,8 @@ struct __fn { } }; -} // namespace __make_heap - inline namespace __cpo { -inline constexpr auto make_heap = __make_heap::__fn{}; +inline constexpr auto make_heap = __make_heap{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h index d0ee6f314b0..f631344422e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h @@ -36,8 +36,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __max { -struct __fn { +struct __max { template <class _Tp, class _Proj = identity, indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> @@ -87,10 +86,9 @@ struct __fn { } } }; -} // namespace __max inline namespace __cpo { -inline constexpr auto max = __max::__fn{}; +inline constexpr auto max = __max{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h index c5773092711..869f71ecc8d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __max_element { -struct __fn { +struct __max_element { template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, @@ -53,10 +52,9 @@ struct __fn { return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj); } }; -} // namespace __max_element inline namespace __cpo { -inline constexpr auto max_element = __max_element::__fn{}; +inline constexpr auto max_element = __max_element{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h index bdf9a62d90b..f3e0486fe48 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_merge.h @@ -39,42 +39,7 @@ namespace ranges { template <class _InIter1, class _InIter2, class _OutIter> using merge_result = in_in_out_result<_InIter1, _InIter2, _OutIter>; -namespace __merge { - -template < class _InIter1, - class _Sent1, - class _InIter2, - class _Sent2, - class _OutIter, - class _Comp, - class _Proj1, - class _Proj2> -_LIBCPP_HIDE_FROM_ABI constexpr merge_result<__remove_cvref_t<_InIter1>, - __remove_cvref_t<_InIter2>, - __remove_cvref_t<_OutIter>> -__merge_impl(_InIter1&& __first1, - _Sent1&& __last1, - _InIter2&& __first2, - _Sent2&& __last2, - _OutIter&& __result, - _Comp&& __comp, - _Proj1&& __proj1, - _Proj2&& __proj2) { - for (; __first1 != __last1 && __first2 != __last2; ++__result) { - if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) { - *__result = *__first2; - ++__first2; - } else { - *__result = *__first1; - ++__first1; - } - } - auto __ret1 = ranges::copy(std::move(__first1), std::move(__last1), std::move(__result)); - auto __ret2 = ranges::copy(std::move(__first2), std::move(__last2), std::move(__ret1.out)); - return {std::move(__ret1.in), std::move(__ret2.in), std::move(__ret2.out)}; -} - -struct __fn { +struct __merge { template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1, input_iterator _InIter2, @@ -120,12 +85,43 @@ struct __fn { __proj1, __proj2); } -}; -} // namespace __merge + template < class _InIter1, + class _Sent1, + class _InIter2, + class _Sent2, + class _OutIter, + class _Comp, + class _Proj1, + class _Proj2> + _LIBCPP_HIDE_FROM_ABI static constexpr merge_result<__remove_cvref_t<_InIter1>, + __remove_cvref_t<_InIter2>, + __remove_cvref_t<_OutIter>> + __merge_impl(_InIter1&& __first1, + _Sent1&& __last1, + _InIter2&& __first2, + _Sent2&& __last2, + _OutIter&& __result, + _Comp&& __comp, + _Proj1&& __proj1, + _Proj2&& __proj2) { + for (; __first1 != __last1 && __first2 != __last2; ++__result) { + if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) { + *__result = *__first2; + ++__first2; + } else { + *__result = *__first1; + ++__first1; + } + } + auto __ret1 = ranges::copy(std::move(__first1), std::move(__last1), std::move(__result)); + auto __ret2 = ranges::copy(std::move(__first2), std::move(__last2), std::move(__ret1.out)); + return {std::move(__ret1.in), std::move(__ret2.in), std::move(__ret2.out)}; + } +}; inline namespace __cpo { -inline constexpr auto merge = __merge::__fn{}; +inline constexpr auto merge = __merge{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h index cc569d2a060..302b5d7975b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h @@ -35,8 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __min { -struct __fn { +struct __min { template <class _Tp, class _Proj = identity, indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> @@ -79,10 +78,9 @@ struct __fn { } } }; -} // namespace __min inline namespace __cpo { -inline constexpr auto min = __min::__fn{}; +inline constexpr auto min = __min{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h index 588ef258e26..fb92ae56bcd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min_element.h @@ -46,8 +46,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last, return __first; } -namespace __min_element { -struct __fn { +struct __min_element { template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, @@ -65,10 +64,9 @@ struct __fn { return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj); } }; -} // namespace __min_element inline namespace __cpo { -inline constexpr auto min_element = __min_element::__fn{}; +inline constexpr auto min_element = __min_element{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h index 09cbefd91a8..4f2b2bf2638 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h @@ -24,6 +24,7 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__type_traits/desugars_to.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_reference.h> #include <__type_traits/is_trivially_copyable.h> #include <__type_traits/remove_cvref.h> @@ -47,8 +48,7 @@ namespace ranges { template <class _T1> using minmax_result = min_max_result<_T1>; -namespace __minmax { -struct __fn { +struct __minmax { template <class _Type, class _Proj = identity, indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> @@ -89,7 +89,7 @@ struct __fn { // vectorize the code. if constexpr (contiguous_range<_Range> && is_integral_v<_ValueT> && __is_cheap_to_copy<_ValueT> & __is_identity<_Proj>::value && - __desugars_to_v<__less_tag, _Comp, _ValueT, _ValueT>) { + __desugars_to_v<__totally_ordered_less_tag, _Comp, _ValueT, _ValueT>) { minmax_result<_ValueT> __result = {__r[0], __r[0]}; for (auto __e : __r) { if (__e < __result.min) @@ -159,10 +159,9 @@ struct __fn { } } }; -} // namespace __minmax inline namespace __cpo { -inline constexpr auto minmax = __minmax::__fn{}; +inline constexpr auto minmax = __minmax{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h index 4bf6d2404e4..e1a22dde095 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h @@ -40,8 +40,7 @@ namespace ranges { template <class _T1> using minmax_element_result = min_max_result<_T1>; -namespace __minmax_element { -struct __fn { +struct __minmax_element { template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, @@ -61,10 +60,9 @@ struct __fn { return {__ret.first, __ret.second}; } }; -} // namespace __minmax_element inline namespace __cpo { -inline constexpr auto minmax_element = __minmax_element::__fn{}; +inline constexpr auto minmax_element = __minmax_element{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h index c4bf0022a9b..b35747dfa43 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h @@ -39,8 +39,7 @@ namespace ranges { template <class _I1, class _I2> using mismatch_result = in_in_result<_I1, _I2>; -namespace __mismatch { -struct __fn { +struct __mismatch { template <class _I1, class _S1, class _I2, class _S2, class _Pred, class _Proj1, class _Proj2> static _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2> __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { @@ -84,10 +83,9 @@ struct __fn { ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), __pred, __proj1, __proj2); } }; -} // namespace __mismatch inline namespace __cpo { -constexpr inline auto mismatch = __mismatch::__fn{}; +constexpr inline auto mismatch = __mismatch{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h index be869f36c97..02bf7fd0061 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move.h @@ -35,8 +35,7 @@ namespace ranges { template <class _InIter, class _OutIter> using move_result = in_out_result<_InIter, _OutIter>; -namespace __move { -struct __fn { +struct __move { template <class _InIter, class _Sent, class _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr static move_result<_InIter, _OutIter> __move_impl(_InIter __first, _Sent __last, _OutIter __result) { @@ -58,10 +57,9 @@ struct __fn { return __move_impl(ranges::begin(__range), ranges::end(__range), std::move(__result)); } }; -} // namespace __move inline namespace __cpo { -inline constexpr auto move = __move::__fn{}; +inline constexpr auto move = __move{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h index 6d4071a33b8..4737e6c9756 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_move_backward.h @@ -37,8 +37,7 @@ namespace ranges { template <class _InIter, class _OutIter> using move_backward_result = in_out_result<_InIter, _OutIter>; -namespace __move_backward { -struct __fn { +struct __move_backward { template <class _InIter, class _Sent, class _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr static move_backward_result<_InIter, _OutIter> __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) { @@ -60,10 +59,9 @@ struct __fn { return __move_backward_impl(ranges::begin(__range), ranges::end(__range), std::move(__result)); } }; -} // namespace __move_backward inline namespace __cpo { -inline constexpr auto move_backward = __move_backward::__fn{}; +inline constexpr auto move_backward = __move_backward{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h index 18535e0a625..1b485423e89 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_next_permutation.h @@ -40,9 +40,7 @@ namespace ranges { template <class _InIter> using next_permutation_result = in_found_result<_InIter>; -namespace __next_permutation { - -struct __fn { +struct __next_permutation { template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity> requires sortable<_Iter, _Comp, _Proj> _LIBCPP_HIDE_FROM_ABI constexpr next_permutation_result<_Iter> @@ -62,10 +60,8 @@ struct __fn { } }; -} // namespace __next_permutation - inline namespace __cpo { -constexpr inline auto next_permutation = __next_permutation::__fn{}; +constexpr inline auto next_permutation = __next_permutation{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h index 7df3c1829fc..a1612826220 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h @@ -30,8 +30,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __none_of { -struct __fn { +struct __none_of { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static bool __none_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { @@ -59,10 +58,9 @@ struct __fn { return __none_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __none_of inline namespace __cpo { -inline constexpr auto none_of = __none_of::__fn{}; +inline constexpr auto none_of = __none_of{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h index 90ade9efe10..e92c51e713c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_nth_element.h @@ -39,9 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __nth_element { - -struct __fn { +struct __nth_element { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __nth_element_fn_impl(_Iter __first, _Iter __nth, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -68,10 +66,8 @@ struct __fn { } }; -} // namespace __nth_element - inline namespace __cpo { -inline constexpr auto nth_element = __nth_element::__fn{}; +inline constexpr auto nth_element = __nth_element{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h index c67247d2e0a..fc8a1f7d930 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort.h @@ -41,9 +41,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __partial_sort { - -struct __fn { +struct __partial_sort { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __partial_sort_fn_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -66,10 +64,8 @@ struct __fn { } }; -} // namespace __partial_sort - inline namespace __cpo { -inline constexpr auto partial_sort = __partial_sort::__fn{}; +inline constexpr auto partial_sort = __partial_sort{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h index b3bdeb78fb6..f221504a8ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partial_sort_copy.h @@ -42,9 +42,7 @@ namespace ranges { template <class _InIter, class _OutIter> using partial_sort_copy_result = in_out_result<_InIter, _OutIter>; -namespace __partial_sort_copy { - -struct __fn { +struct __partial_sort_copy { template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, random_access_iterator _Iter2, @@ -98,10 +96,8 @@ struct __fn { } }; -} // namespace __partial_sort_copy - inline namespace __cpo { -inline constexpr auto partial_sort_copy = __partial_sort_copy::__fn{}; +inline constexpr auto partial_sort_copy = __partial_sort_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h index a67ac4c9675..b9cc3c18937 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition.h @@ -24,6 +24,7 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/subrange.h> +#include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -40,9 +41,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __partition { - -struct __fn { +struct __partition { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI static constexpr subrange<__remove_cvref_t<_Iter>> __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) { @@ -72,10 +71,8 @@ struct __fn { } }; -} // namespace __partition - inline namespace __cpo { -inline constexpr auto partition = __partition::__fn{}; +inline constexpr auto partition = __partition{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h index d60c865dd2a..47878a40172 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_copy.h @@ -38,9 +38,7 @@ namespace ranges { template <class _InIter, class _OutIter1, class _OutIter2> using partition_copy_result = in_out_out_result<_InIter, _OutIter1, _OutIter2>; -namespace __partition_copy { - -struct __fn { +struct __partition_copy { // TODO(ranges): delegate to the classic algorithm. template <class _InIter, class _Sent, class _OutIter1, class _OutIter2, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static partition_copy_result<__remove_cvref_t<_InIter>, @@ -94,10 +92,8 @@ struct __fn { } }; -} // namespace __partition_copy - inline namespace __cpo { -inline constexpr auto partition_copy = __partition_copy::__fn{}; +inline constexpr auto partition_copy = __partition_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h index c5b11b5fed1..324efbb86d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_partition_point.h @@ -35,9 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __partition_point { - -struct __fn { +struct __partition_point { // TODO(ranges): delegate to the classic algorithm. template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter @@ -77,10 +75,8 @@ struct __fn { } }; -} // namespace __partition_point - inline namespace __cpo { -inline constexpr auto partition_point = __partition_point::__fn{}; +inline constexpr auto partition_point = __partition_point{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h index 01f92c0f228..eccf54c094e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_pop_heap.h @@ -40,9 +40,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __pop_heap { - -struct __fn { +struct __pop_heap { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __pop_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -70,10 +68,8 @@ struct __fn { } }; -} // namespace __pop_heap - inline namespace __cpo { -inline constexpr auto pop_heap = __pop_heap::__fn{}; +inline constexpr auto pop_heap = __pop_heap{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h index 225cee9b75e..f2294b1cb00 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_prev_permutation.h @@ -40,9 +40,7 @@ namespace ranges { template <class _InIter> using prev_permutation_result = in_found_result<_InIter>; -namespace __prev_permutation { - -struct __fn { +struct __prev_permutation { template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity> requires sortable<_Iter, _Comp, _Proj> _LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<_Iter> @@ -62,10 +60,8 @@ struct __fn { } }; -} // namespace __prev_permutation - inline namespace __cpo { -constexpr inline auto prev_permutation = __prev_permutation::__fn{}; +constexpr inline auto prev_permutation = __prev_permutation{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h index 9d187af38c5..c5e0465bdcf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_push_heap.h @@ -40,9 +40,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __push_heap { - -struct __fn { +struct __push_heap { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __push_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -69,10 +67,8 @@ struct __fn { } }; -} // namespace __push_heap - inline namespace __cpo { -inline constexpr auto push_heap = __push_heap::__fn{}; +inline constexpr auto push_heap = __push_heap{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h index 17c3a2c5cd0..6fbc49eba8a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove.h @@ -33,8 +33,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __remove { -struct __fn { +struct __remove { template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> @@ -52,10 +51,9 @@ struct __fn { return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __remove inline namespace __cpo { -inline constexpr auto remove = __remove::__fn{}; +inline constexpr auto remove = __remove{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h index 84529eceac6..764c52ee16b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy.h @@ -38,9 +38,7 @@ namespace ranges { template <class _InIter, class _OutIter> using remove_copy_result = in_out_result<_InIter, _OutIter>; -namespace __remove_copy { - -struct __fn { +struct __remove_copy { template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter, @@ -65,10 +63,8 @@ struct __fn { } }; -} // namespace __remove_copy - inline namespace __cpo { -inline constexpr auto remove_copy = __remove_copy::__fn{}; +inline constexpr auto remove_copy = __remove_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h index 56fe0175331..87136ae8258 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_copy_if.h @@ -53,9 +53,7 @@ __remove_copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& _ return {std::move(__first), std::move(__result)}; } -namespace __remove_copy_if { - -struct __fn { +struct __remove_copy_if { template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter, @@ -79,10 +77,8 @@ struct __fn { } }; -} // namespace __remove_copy_if - inline namespace __cpo { -inline constexpr auto remove_copy_if = __remove_copy_if::__fn{}; +inline constexpr auto remove_copy_if = __remove_copy_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h index 0ea5d9a01b8..384b3d41d08 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_remove_if.h @@ -53,8 +53,7 @@ __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { return {__new_end, __i}; } -namespace __remove_if { -struct __fn { +struct __remove_if { template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, @@ -73,10 +72,9 @@ struct __fn { return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); } }; -} // namespace __remove_if inline namespace __cpo { -inline constexpr auto remove_if = __remove_if::__fn{}; +inline constexpr auto remove_if = __remove_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h index 2b88dc03297..15b1f38554a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __replace { -struct __fn { +struct __replace { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type1, class _Type2, class _Proj = identity> requires indirectly_writable<_Iter, const _Type2&> && indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type1*> @@ -52,10 +51,9 @@ struct __fn { return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj); } }; -} // namespace __replace inline namespace __cpo { -inline constexpr auto replace = __replace::__fn{}; +inline constexpr auto replace = __replace{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h index 633f993e5c9..7ab1c71543e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy.h @@ -38,9 +38,7 @@ namespace ranges { template <class _InIter, class _OutIter> using replace_copy_result = in_out_result<_InIter, _OutIter>; -namespace __replace_copy { - -struct __fn { +struct __replace_copy { template <input_iterator _InIter, sentinel_for<_InIter> _Sent, class _OldType, @@ -77,10 +75,8 @@ struct __fn { } }; -} // namespace __replace_copy - inline namespace __cpo { -inline constexpr auto replace_copy = __replace_copy::__fn{}; +inline constexpr auto replace_copy = __replace_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h index e065c3ac0ac..852ec45edae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_copy_if.h @@ -52,9 +52,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> __repl return {std::move(__first), std::move(__result)}; } -namespace __replace_copy_if { - -struct __fn { +struct __replace_copy_if { template <input_iterator _InIter, sentinel_for<_InIter> _Sent, class _Type, @@ -82,10 +80,8 @@ struct __fn { } }; -} // namespace __replace_copy_if - inline namespace __cpo { -inline constexpr auto replace_copy_if = __replace_copy_if::__fn{}; +inline constexpr auto replace_copy_if = __replace_copy_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h index 6445f42aea1..baa566810b5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h @@ -42,8 +42,7 @@ __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new return __first; } -namespace __replace_if { -struct __fn { +struct __replace_if { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, @@ -65,10 +64,9 @@ struct __fn { return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj); } }; -} // namespace __replace_if inline namespace __cpo { -inline constexpr auto replace_if = __replace_if::__fn{}; +inline constexpr auto replace_if = __replace_if{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h index 9ec865995b4..4e821187197 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h @@ -27,8 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __reverse { -struct __fn { +struct __reverse { template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent> requires permutable<_Iter> _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last) const { @@ -65,10 +64,9 @@ struct __fn { return (*this)(ranges::begin(__range), ranges::end(__range)); } }; -} // namespace __reverse inline namespace __cpo { -inline constexpr auto reverse = __reverse::__fn{}; +inline constexpr auto reverse = __reverse{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h index 60043787a71..e5ca5cf652d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse_copy.h @@ -37,8 +37,7 @@ namespace ranges { template <class _InIter, class _OutIter> using reverse_copy_result = in_out_result<_InIter, _OutIter>; -namespace __reverse_copy { -struct __fn { +struct __reverse_copy { template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter> requires indirectly_copyable<_InIter, _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<_InIter, _OutIter> @@ -54,10 +53,9 @@ struct __fn { return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)}; } }; -} // namespace __reverse_copy inline namespace __cpo { -inline constexpr auto reverse_copy = __reverse_copy::__fn{}; +inline constexpr auto reverse_copy = __reverse_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h index 8d33a6f0799..c1affc684ae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate.h @@ -33,9 +33,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __rotate { - -struct __fn { +struct __rotate { template <class _Iter, class _Sent> _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> __rotate_fn_impl(_Iter __first, _Iter __middle, _Sent __last) { auto __ret = std::__rotate<_RangeAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last)); @@ -55,10 +53,8 @@ struct __fn { } }; -} // namespace __rotate - inline namespace __cpo { -inline constexpr auto rotate = __rotate::__fn{}; +inline constexpr auto rotate = __rotate{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h index 26fe110b538..c0b4264a1b2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_rotate_copy.h @@ -34,8 +34,7 @@ namespace ranges { template <class _InIter, class _OutIter> using rotate_copy_result = in_out_result<_InIter, _OutIter>; -namespace __rotate_copy { -struct __fn { +struct __rotate_copy { template <forward_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter> requires indirectly_copyable<_InIter, _OutIter> _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<_InIter, _OutIter> @@ -52,10 +51,9 @@ struct __fn { return (*this)(ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__result)); } }; -} // namespace __rotate_copy inline namespace __cpo { -inline constexpr auto rotate_copy = __rotate_copy::__fn{}; +inline constexpr auto rotate_copy = __rotate_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h index e4f60a7b66b..a3b29608150 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sample.h @@ -35,9 +35,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __sample { - -struct __fn { +struct __sample { template <input_iterator _Iter, sentinel_for<_Iter> _Sent, weakly_incrementable _OutIter, class _Gen> requires(forward_iterator<_Iter> || random_access_iterator<_OutIter>) && indirectly_copyable<_Iter, _OutIter> && uniform_random_bit_generator<remove_reference_t<_Gen>> @@ -58,10 +56,8 @@ struct __fn { } }; -} // namespace __sample - inline namespace __cpo { -inline constexpr auto sample = __sample::__fn{}; +inline constexpr auto sample = __sample{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h index 55294c60631..b7115120396 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search.h @@ -33,8 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __search { -struct __fn { +struct __search { template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_impl( _Iter1 __first1, @@ -120,10 +119,9 @@ struct __fn { __proj2); } }; -} // namespace __search inline namespace __cpo { -inline constexpr auto search = __search::__fn{}; +inline constexpr auto search = __search{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h index 56e12755b9b..81b568c0965 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_search_n.h @@ -39,8 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __search_n { -struct __fn { +struct __search_n { template <class _Iter1, class _Sent1, class _SizeT, class _Type, class _Pred, class _Proj> _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_n_impl( _Iter1 __first, _Sent1 __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) { @@ -100,10 +99,9 @@ struct __fn { return __ranges_search_n_impl(ranges::begin(__range), ranges::end(__range), __count, __value, __pred, __proj); } }; -} // namespace __search_n inline namespace __cpo { -inline constexpr auto search_n = __search_n::__fn{}; +inline constexpr auto search_n = __search_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h index 0841fb4ffd0..aa36e358ef6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_difference.h @@ -42,9 +42,7 @@ namespace ranges { template <class _InIter, class _OutIter> using set_difference_result = in_out_result<_InIter, _OutIter>; -namespace __set_difference { - -struct __fn { +struct __set_difference { template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1, input_iterator _InIter2, @@ -93,10 +91,8 @@ struct __fn { } }; -} // namespace __set_difference - inline namespace __cpo { -inline constexpr auto set_difference = __set_difference::__fn{}; +inline constexpr auto set_difference = __set_difference{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h index 9427379745b..068794cf1b1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_intersection.h @@ -40,9 +40,7 @@ namespace ranges { template <class _InIter1, class _InIter2, class _OutIter> using set_intersection_result = in_in_out_result<_InIter1, _InIter2, _OutIter>; -namespace __set_intersection { - -struct __fn { +struct __set_intersection { template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1, input_iterator _InIter2, @@ -98,10 +96,8 @@ struct __fn { } }; -} // namespace __set_intersection - inline namespace __cpo { -inline constexpr auto set_intersection = __set_intersection::__fn{}; +inline constexpr auto set_intersection = __set_intersection{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h index 995eb0999d9..e3b73c3eb1c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_symmetric_difference.h @@ -40,9 +40,7 @@ namespace ranges { template <class _InIter1, class _InIter2, class _OutIter> using set_symmetric_difference_result = in_in_out_result<_InIter1, _InIter2, _OutIter>; -namespace __set_symmetric_difference { - -struct __fn { +struct __set_symmetric_difference { template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1, input_iterator _InIter2, @@ -98,10 +96,8 @@ struct __fn { } }; -} // namespace __set_symmetric_difference - inline namespace __cpo { -inline constexpr auto set_symmetric_difference = __set_symmetric_difference::__fn{}; +inline constexpr auto set_symmetric_difference = __set_symmetric_difference{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h index e870e390cc6..f2e3ddb89d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_set_union.h @@ -43,9 +43,7 @@ namespace ranges { template <class _InIter1, class _InIter2, class _OutIter> using set_union_result = in_in_out_result<_InIter1, _InIter2, _OutIter>; -namespace __set_union { - -struct __fn { +struct __set_union { template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1, input_iterator _InIter2, @@ -99,10 +97,8 @@ struct __fn { } }; -} // namespace __set_union - inline namespace __cpo { -inline constexpr auto set_union = __set_union::__fn{}; +inline constexpr auto set_union = __set_union{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h index ab98ea22caa..87cb3685bb9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_shuffle.h @@ -39,9 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __shuffle { - -struct __fn { +struct __shuffle { template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Gen> requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>> _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const { @@ -56,10 +54,8 @@ struct __fn { } }; -} // namespace __shuffle - inline namespace __cpo { -inline constexpr auto shuffle = __shuffle::__fn{}; +inline constexpr auto shuffle = __shuffle{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h index 0296c146b3e..2afad4c4130 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort.h @@ -39,9 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __sort { - -struct __fn { +struct __sort { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -68,10 +66,8 @@ struct __fn { } }; -} // namespace __sort - inline namespace __cpo { -inline constexpr auto sort = __sort::__fn{}; +inline constexpr auto sort = __sort{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h index bab30df1708..d3e20874fac 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_sort_heap.h @@ -40,9 +40,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __sort_heap { - -struct __fn { +struct __sort_heap { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI constexpr static _Iter __sort_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { @@ -69,10 +67,8 @@ struct __fn { } }; -} // namespace __sort_heap - inline namespace __cpo { -inline constexpr auto sort_heap = __sort_heap::__fn{}; +inline constexpr auto sort_heap = __sort_heap{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h index f34027ff772..cfc02e1e97b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_partition.h @@ -42,9 +42,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __stable_partition { - -struct __fn { +struct __stable_partition { template <class _Iter, class _Sent, class _Proj, class _Pred> _LIBCPP_HIDE_FROM_ABI static subrange<__remove_cvref_t<_Iter>> __stable_partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) { @@ -76,10 +74,8 @@ struct __fn { } }; -} // namespace __stable_partition - inline namespace __cpo { -inline constexpr auto stable_partition = __stable_partition::__fn{}; +inline constexpr auto stable_partition = __stable_partition{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h index 93909e253cc..9c7df80ae98 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_stable_sort.h @@ -39,9 +39,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __stable_sort { - -struct __fn { +struct __stable_sort { template <class _Iter, class _Sent, class _Comp, class _Proj> _LIBCPP_HIDE_FROM_ABI static _Iter __stable_sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { auto __last_iter = ranges::next(__first, __last); @@ -66,10 +64,8 @@ struct __fn { } }; -} // namespace __stable_sort - inline namespace __cpo { -inline constexpr auto stable_sort = __stable_sort::__fn{}; +inline constexpr auto stable_sort = __stable_sort{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h index 17084e4f243..ae145d59010 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_starts_with.h @@ -32,8 +32,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __starts_with { -struct __fn { +struct __starts_with { template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, input_iterator _Iter2, @@ -50,7 +49,7 @@ struct __fn { _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) { - return __mismatch::__fn::__go( + return __mismatch::__go( std::move(__first1), std::move(__last1), std::move(__first2), @@ -69,7 +68,7 @@ struct __fn { requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) { - return __mismatch::__fn::__go( + return __mismatch::__go( ranges::begin(__range1), ranges::end(__range1), ranges::begin(__range2), @@ -80,9 +79,8 @@ struct __fn { .in2 == ranges::end(__range2); } }; -} // namespace __starts_with inline namespace __cpo { -inline constexpr auto starts_with = __starts_with::__fn{}; +inline constexpr auto starts_with = __starts_with{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h index b6d9f618395..ab6db50d8a1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h @@ -36,8 +36,7 @@ namespace ranges { template <class _I1, class _I2> using swap_ranges_result = in_in_result<_I1, _I2>; -namespace __swap_ranges { -struct __fn { +struct __swap_ranges { template <input_iterator _I1, sentinel_for<_I1> _S1, input_iterator _I2, sentinel_for<_I2> _S2> requires indirectly_swappable<_I1, _I2> _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2> @@ -54,10 +53,9 @@ struct __fn { return operator()(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2)); } }; -} // namespace __swap_ranges inline namespace __cpo { -inline constexpr auto swap_ranges = __swap_ranges::__fn{}; +inline constexpr auto swap_ranges = __swap_ranges{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h index 7850ec4f846..09131182196 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h @@ -41,8 +41,7 @@ using unary_transform_result = in_out_result<_Ip, _Op>; template <class _I1, class _I2, class _O1> using binary_transform_result = in_in_out_result<_I1, _I2, _O1>; -namespace __transform { -struct __fn { +struct __transform { private: template <class _InIter, class _Sent, class _OutIter, class _Func, class _Proj> _LIBCPP_HIDE_FROM_ABI static constexpr unary_transform_result<_InIter, _OutIter> @@ -161,10 +160,9 @@ public: __projection2); } }; -} // namespace __transform inline namespace __cpo { -inline constexpr auto transform = __transform::__fn{}; +inline constexpr auto transform = __transform{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h index 7a9b7843218..a817359abd8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique.h @@ -40,9 +40,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __unique { - -struct __fn { +struct __unique { template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, @@ -66,10 +64,8 @@ struct __fn { } }; -} // namespace __unique - inline namespace __cpo { -inline constexpr auto unique = __unique::__fn{}; +inline constexpr auto unique = __unique{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h index 61133885ae8..3b4a64e94ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_unique_copy.h @@ -44,12 +44,10 @@ namespace ranges { template <class _InIter, class _OutIter> using unique_copy_result = in_out_result<_InIter, _OutIter>; -namespace __unique_copy { - template <class _InIter, class _OutIter> concept __can_reread_from_output = (input_iterator<_OutIter> && same_as<iter_value_t<_InIter>, iter_value_t<_OutIter>>); -struct __fn { +struct __unique_copy { template <class _InIter, class _OutIter> static consteval auto __get_algo_tag() { if constexpr (forward_iterator<_InIter>) { @@ -104,10 +102,8 @@ struct __fn { } }; -} // namespace __unique_copy - inline namespace __cpo { -inline constexpr auto unique_copy = __unique_copy::__fn{}; +inline constexpr auto unique_copy = __unique_copy{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h index fa6fa7f70ed..4b2835d4d58 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h @@ -30,8 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { -namespace __upper_bound { -struct __fn { +struct __upper_bound { template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, @@ -60,10 +59,9 @@ struct __fn { ranges::begin(__r), ranges::end(__r), __value, __comp_lhs_rhs_swapped, __proj); } }; -} // namespace __upper_bound inline namespace __cpo { -inline constexpr auto upper_bound = __upper_bound::__fn{}; +inline constexpr auto upper_bound = __upper_bound{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h index fd01c23cb67..b2d7023c5b0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h @@ -24,7 +24,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { __first = std::find(__first, __last, __value); if (__first != __last) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h index b14f3c0efa7..56fd745569e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_if.h @@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _ForwardIterator, class _Predicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred); if (__first != __last) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h index b82ca780953..161fd39d861 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search.h @@ -14,11 +14,11 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/pair.h> @@ -160,20 +160,20 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __searc } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { - static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, - "BinaryPredicate has to be callable"); + static_assert(__is_callable<_BinaryPredicate&, decltype(*__first1), decltype(*__first2)>::value, + "The comparator has to be callable"); auto __proj = __identity(); return std::__search_impl(__first1, __last1, __first2, __last2, __pred, __proj, __proj).first; } template <class _ForwardIterator1, class _ForwardIterator2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { return std::search(__first1, __last1, __first2, __last2, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h index 771647d3168..38474e1b237 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/search_n.h @@ -14,12 +14,13 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__ranges/concepts.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_callable.h> #include <__utility/convert_to_integral.h> #include <__utility/pair.h> @@ -136,16 +137,16 @@ __search_n_impl(_Iter1 __first, _Sent1 __last, _DiffT __count, const _Type& __va } template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search_n( +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search_n( _ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value, _BinaryPredicate __pred) { static_assert( - __is_callable<_BinaryPredicate, decltype(*__first), const _Tp&>::value, "BinaryPredicate has to be callable"); + __is_callable<_BinaryPredicate&, decltype(*__first), const _Tp&>::value, "The comparator has to be callable"); auto __proj = __identity(); return std::__search_n_impl(__first, __last, std::__convert_to_integral(__count), __value, __pred, __proj).first; } template <class _ForwardIterator, class _Size, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value) { return std::search_n(__first, __last, std::__convert_to_integral(__count), __value, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h index f414bcecb50..6230b831aed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_difference.h @@ -15,7 +15,6 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> #include <__type_traits/remove_cvref.h> #include <__utility/move.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h index 73d888d1b03..6246e24b9ca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/set_intersection.h @@ -12,10 +12,16 @@ #include <__algorithm/comp.h> #include <__algorithm/comp_ref_type.h> #include <__algorithm/iterator_operations.h> +#include <__algorithm/lower_bound.h> #include <__config> +#include <__functional/identity.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__type_traits/is_same.h> +#include <__utility/exchange.h> +#include <__utility/forward.h> #include <__utility/move.h> +#include <__utility/swap.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -38,10 +44,103 @@ struct __set_intersection_result { : __in1_(std::move(__in_iter1)), __in2_(std::move(__in_iter2)), __out_(std::move(__out_iter)) {} }; -template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_intersection_result<_InIter1, _InIter2, _OutIter> +// Helper for __set_intersection() with one-sided binary search: populate result and advance input iterators if they +// are found to potentially contain the same value in two consecutive calls. This function is very intimately related to +// the way it is used and doesn't attempt to abstract that, it's not appropriate for general usage outside of its +// context. +template <class _InForwardIter1, class _InForwardIter2, class _OutIter> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_intersection_add_output_if_equal( + bool __may_be_equal, + _InForwardIter1& __first1, + _InForwardIter2& __first2, + _OutIter& __result, + bool& __prev_may_be_equal) { + if (__may_be_equal && __prev_may_be_equal) { + *__result = *__first1; + ++__result; + ++__first1; + ++__first2; + __prev_may_be_equal = false; + } else { + __prev_may_be_equal = __may_be_equal; + } +} + +// With forward iterators we can make multiple passes over the data, allowing the use of one-sided binary search to +// reduce best-case complexity to log(N). Understanding how we can use binary search and still respect complexity +// guarantees is _not_ straightforward: the guarantee is "at most 2*(N+M)-1 comparisons", and one-sided binary search +// will necessarily overshoot depending on the position of the needle in the haystack -- for instance, if we're +// searching for 3 in (1, 2, 3, 4), we'll check if 3<1, then 3<2, then 3<4, and, finally, 3<3, for a total of 4 +// comparisons, when linear search would have yielded 3. However, because we won't need to perform the intervening +// reciprocal comparisons (ie 1<3, 2<3, 4<3), that extra comparison doesn't run afoul of the guarantee. Additionally, +// this type of scenario can only happen for match distances of up to 5 elements, because 2*log2(8) is 6, and we'll +// still be worse-off at position 5 of an 8-element set. From then onwards these scenarios can't happen. TL;DR: we'll be +// 1 comparison worse-off compared to the classic linear-searching algorithm if matching position 3 of a set with 4 +// elements, or position 5 if the set has 7 or 8 elements, but we'll never exceed the complexity guarantees from the +// standard. +template <class _AlgPolicy, + class _Compare, + class _InForwardIter1, + class _Sent1, + class _InForwardIter2, + class _Sent2, + class _OutIter> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI +_LIBCPP_CONSTEXPR_SINCE_CXX20 __set_intersection_result<_InForwardIter1, _InForwardIter2, _OutIter> __set_intersection( - _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) { + _InForwardIter1 __first1, + _Sent1 __last1, + _InForwardIter2 __first2, + _Sent2 __last2, + _OutIter __result, + _Compare&& __comp, + std::forward_iterator_tag, + std::forward_iterator_tag) { + _LIBCPP_CONSTEXPR std::__identity __proj; + bool __prev_may_be_equal = false; + + while (__first2 != __last2) { + _InForwardIter1 __first1_next = + std::__lower_bound_onesided<_AlgPolicy>(__first1, __last1, *__first2, __comp, __proj); + std::swap(__first1_next, __first1); + // keeping in mind that a==b iff !(a<b) && !(b<a): + // if we can't advance __first1, that means !(*__first1 < *_first2), therefore __may_be_equal==true + std::__set_intersection_add_output_if_equal( + __first1 == __first1_next, __first1, __first2, __result, __prev_may_be_equal); + if (__first1 == __last1) + break; + + _InForwardIter2 __first2_next = + std::__lower_bound_onesided<_AlgPolicy>(__first2, __last2, *__first1, __comp, __proj); + std::swap(__first2_next, __first2); + std::__set_intersection_add_output_if_equal( + __first2 == __first2_next, __first1, __first2, __result, __prev_may_be_equal); + } + return __set_intersection_result<_InForwardIter1, _InForwardIter2, _OutIter>( + _IterOps<_AlgPolicy>::next(std::move(__first1), std::move(__last1)), + _IterOps<_AlgPolicy>::next(std::move(__first2), std::move(__last2)), + std::move(__result)); +} + +// input iterators are not suitable for multipass algorithms, so we stick to the classic single-pass version +template <class _AlgPolicy, + class _Compare, + class _InInputIter1, + class _Sent1, + class _InInputIter2, + class _Sent2, + class _OutIter> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI +_LIBCPP_CONSTEXPR_SINCE_CXX20 __set_intersection_result<_InInputIter1, _InInputIter2, _OutIter> +__set_intersection( + _InInputIter1 __first1, + _Sent1 __last1, + _InInputIter2 __first2, + _Sent2 __last2, + _OutIter __result, + _Compare&& __comp, + std::input_iterator_tag, + std::input_iterator_tag) { while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first1, *__first2)) ++__first1; @@ -55,12 +154,28 @@ __set_intersection( } } - return __set_intersection_result<_InIter1, _InIter2, _OutIter>( + return __set_intersection_result<_InInputIter1, _InInputIter2, _OutIter>( _IterOps<_AlgPolicy>::next(std::move(__first1), std::move(__last1)), _IterOps<_AlgPolicy>::next(std::move(__first2), std::move(__last2)), std::move(__result)); } +template <class _AlgPolicy, class _Compare, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI +_LIBCPP_CONSTEXPR_SINCE_CXX20 __set_intersection_result<_InIter1, _InIter2, _OutIter> +__set_intersection( + _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Sent2 __last2, _OutIter __result, _Compare&& __comp) { + return std::__set_intersection<_AlgPolicy>( + std::move(__first1), + std::move(__last1), + std::move(__first2), + std::move(__last2), + std::move(__result), + std::forward<_Compare>(__comp), + typename std::_IterOps<_AlgPolicy>::template __iterator_category<_InIter1>(), + typename std::_IterOps<_AlgPolicy>::template __iterator_category<_InIter2>()); +} + template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_intersection( _InputIterator1 __first1, diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/simd_utils.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/simd_utils.h index 840400729ea..fff3a086b1c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/simd_utils.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/simd_utils.h @@ -110,19 +110,19 @@ using __simd_vector_underlying_type_t = decltype(std::__simd_vector_underlying_t // This isn't inlined without always_inline when loading chars. template <class _VecT, class _Iter> -_LIBCPP_NODISCARD _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __load_vector(_Iter __iter) noexcept { +[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __load_vector(_Iter __iter) noexcept { return [=]<size_t... _Indices>(index_sequence<_Indices...>) _LIBCPP_ALWAYS_INLINE noexcept { return _VecT{__iter[_Indices]...}; }(make_index_sequence<__simd_vector_size_v<_VecT>>{}); } template <class _Tp, size_t _Np> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool __all_of(__simd_vector<_Tp, _Np> __vec) noexcept { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __all_of(__simd_vector<_Tp, _Np> __vec) noexcept { return __builtin_reduce_and(__builtin_convertvector(__vec, __simd_vector<bool, _Np>)); } template <class _Tp, size_t _Np> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI size_t __find_first_set(__simd_vector<_Tp, _Np> __vec) noexcept { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_set(__simd_vector<_Tp, _Np> __vec) noexcept { using __mask_vec = __simd_vector<bool, _Np>; // This has MSan disabled du to https://github.com/llvm/llvm-project/issues/85876 @@ -151,7 +151,7 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI size_t __find_first_set(__simd_vector<_T } template <class _Tp, size_t _Np> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI size_t __find_first_not_set(__simd_vector<_Tp, _Np> __vec) noexcept { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_not_set(__simd_vector<_Tp, _Np> __vec) noexcept { return std::__find_first_set(~__vec); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h index 07b5814639e..0b2137dee2f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h @@ -28,8 +28,11 @@ #include <__iterator/iterator_traits.h> #include <__type_traits/conditional.h> #include <__type_traits/disjunction.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_constant_evaluated.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> #include <__utility/pair.h> #include <climits> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h index 8bb1eaf2d22..5df5e8eaf68 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h @@ -16,8 +16,9 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__memory/destruct_n.h> -#include <__memory/temporary_buffer.h> #include <__memory/unique_ptr.h> +#include <__memory/unique_temporary_buffer.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> #include <__utility/pair.h> #include <new> @@ -132,14 +133,12 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred // We now have a reduced range [__first, __last) // *__first is known to be false difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last); + __unique_temporary_buffer<value_type> __unique_buf; pair<value_type*, ptrdiff_t> __p(0, 0); - unique_ptr<value_type, __return_temporary_buffer> __h; if (__len >= __alloc_limit) { - // TODO: Remove the use of std::get_temporary_buffer - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - __p = std::get_temporary_buffer<value_type>(__len); - _LIBCPP_SUPPRESS_DEPRECATED_POP - __h.reset(__p.first); + __unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len); + __p.first = __unique_buf.get(); + __p.second = __unique_buf.get_deleter().__count_; } return std::__stable_partition_impl<_AlgPolicy, _Predicate&>( std::move(__first), std::move(__last), __pred, __len, __p, forward_iterator_tag()); @@ -272,14 +271,12 @@ _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl( // *__last is known to be true // __len >= 2 difference_type __len = _IterOps<_AlgPolicy>::distance(__first, __last) + 1; + __unique_temporary_buffer<value_type> __unique_buf; pair<value_type*, ptrdiff_t> __p(0, 0); - unique_ptr<value_type, __return_temporary_buffer> __h; if (__len >= __alloc_limit) { - // TODO: Remove the use of std::get_temporary_buffer - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - __p = std::get_temporary_buffer<value_type>(__len); - _LIBCPP_SUPPRESS_DEPRECATED_POP - __h.reset(__p.first); + __unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len); + __p.first = __unique_buf.get(); + __p.second = __unique_buf.get_deleter().__count_; } return std::__stable_partition_impl<_AlgPolicy, _Predicate&>( std::move(__first), std::move(__last), __pred, __len, __p, bidirectional_iterator_tag()); diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h index 726e7e16b35..ec556aad82e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_sort.h @@ -18,8 +18,8 @@ #include <__debug_utils/strict_weak_ordering_check.h> #include <__iterator/iterator_traits.h> #include <__memory/destruct_n.h> -#include <__memory/temporary_buffer.h> #include <__memory/unique_ptr.h> +#include <__memory/unique_temporary_buffer.h> #include <__type_traits/is_trivially_assignable.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -241,14 +241,12 @@ __stable_sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type; difference_type __len = __last - __first; + __unique_temporary_buffer<value_type> __unique_buf; pair<value_type*, ptrdiff_t> __buf(0, 0); - unique_ptr<value_type, __return_temporary_buffer> __h; if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value)) { - // TODO: Remove the use of std::get_temporary_buffer - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - __buf = std::get_temporary_buffer<value_type>(__len); - _LIBCPP_SUPPRESS_DEPRECATED_POP - __h.reset(__buf.first); + __unique_buf = std::__allocate_unique_temporary_buffer<value_type>(__len); + __buf.first = __unique_buf.get(); + __buf.second = __unique_buf.get_deleter().__count_; } std::__stable_sort<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __last, __comp, __len, __buf.first, __buf.second); diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h index 70c5818976f..5702a1fee08 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/three_way_comp_ref_type.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H #define _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H +#include <__assert> #include <__compare/ordering.h> #include <__config> #include <__utility/declval.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h index aef0fbfb7c2..bc7a8925e12 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h @@ -10,7 +10,7 @@ #define _LIBCPP___ALGORITHM_RANGES_UNIFORM_RANDOM_BIT_GENERATOR_ADAPTOR_H #include <__config> -#include <__functional/invoke.h> +#include <__type_traits/invoke.h> #include <__type_traits/remove_cvref.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h index d597014596f..1f0c4ffa82d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unique.h @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // unique template <class _AlgPolicy, class _Iter, class _Sent, class _BinaryPredicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 std::pair<_Iter, _Iter> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 std::pair<_Iter, _Iter> __unique(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { __first = std::__adjacent_find(__first, __last, __pred); if (__first != __last) { @@ -46,13 +46,13 @@ __unique(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { } template <class _ForwardIterator, class _BinaryPredicate> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { return std::__unique<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred).first; } template <class _ForwardIterator> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last) { return std::unique(__first, __last, __equal_to()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h index c39dec2e896..d77286c9e5a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h @@ -18,6 +18,8 @@ #include <__iterator/advance.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/invoke.h> +#include <__type_traits/is_callable.h> #include <__type_traits/is_constructible.h> #include <__utility/move.h> @@ -48,15 +50,16 @@ __upper_bound(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp } template <class _ForwardIterator, class _Tp, class _Compare> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) { + static_assert(__is_callable<_Compare&, const _Tp&, decltype(*__first)>::value, "The comparator has to be callable"); static_assert(is_copy_constructible<_ForwardIterator>::value, "Iterator has to be copy constructible"); return std::__upper_bound<_ClassicAlgPolicy>( std::move(__first), std::move(__last), __value, std::move(__comp), std::__identity()); } template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) { return std::upper_bound(std::move(__first), std::move(__last), __value, __less<>()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__assert b/contrib/libs/cxxsupp/libcxx/include/__assert index 49769fb4d44..90eaa602358 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assert +++ b/contrib/libs/cxxsupp/libcxx/include/__assert @@ -23,10 +23,10 @@ : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING(__LINE__) ": assertion " _LIBCPP_TOSTRING( \ expression) " failed: " message "\n")) -// TODO: __builtin_assume can currently inhibit optimizations. Until this has been fixed and we can add -// assumptions without a clear optimization intent, disable that to avoid worsening the code generation. -// See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 for a discussion. -#if 0 && __has_builtin(__builtin_assume) +// WARNING: __builtin_assume can currently inhibit optimizations. Only add assumptions with a clear +// optimization intent. See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 for a +// discussion. +#if __has_builtin(__builtin_assume) # define _LIBCPP_ASSUME(expression) \ (_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ __builtin_assume(static_cast<bool>(expression)) _LIBCPP_DIAGNOSTIC_POP) @@ -44,18 +44,18 @@ # define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message) // Disabled checks. // On most modern platforms, dereferencing a null pointer does not lead to an actual memory access. -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_NON_NULL(expression, message) ((void)0) // Overlapping ranges will make algorithms produce incorrect results but don't directly lead to a security // vulnerability. -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) ((void)0) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) ((void)0) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) ((void)0) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) ((void)0) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) ((void)0) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) ((void)0) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) ((void)0) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) ((void)0) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) ((void)0) // Extensive hardening mode checks. @@ -73,8 +73,8 @@ # define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSERT(expression, message) # define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) // Disabled checks. -# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) ((void)0) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) ((void)0) // Debug hardening mode checks. @@ -99,18 +99,18 @@ #else // All checks disabled. -# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression) -# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) +# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) ((void)0) +# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) ((void)0) +# define _LIBCPP_ASSERT_NON_NULL(expression, message) ((void)0) +# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) ((void)0) +# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) ((void)0) +# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) ((void)0) +# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) ((void)0) +# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) ((void)0) +# define _LIBCPP_ASSERT_PEDANTIC(expression, message) ((void)0) +# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) ((void)0) +# define _LIBCPP_ASSERT_INTERNAL(expression, message) ((void)0) +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) ((void)0) #endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST // clang-format on diff --git a/contrib/libs/cxxsupp/libcxx/include/__assertion_handler b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler index 8bc0553c078..8f37b9089ec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assertion_handler +++ b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler @@ -23,8 +23,18 @@ #else -// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available. -# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap()) +# if __has_builtin(__builtin_verbose_trap) +// AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream +// version before upstream Clang actually got the builtin. +// TODO: Remove once AppleClang supports the two-arguments version of the builtin. +# if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 17000 +# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap(message) +# else +# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message) +# endif +# else +# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap()) +# endif #endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic.h index bd3f659c22d..af6d12b5e4c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic.h @@ -16,8 +16,10 @@ #include <__config> #include <__functional/operations.h> #include <__memory/addressof.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_floating_point.h> #include <__type_traits/is_function.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_const.h> #include <__type_traits/remove_pointer.h> @@ -429,6 +431,8 @@ _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit( return __o->compare_exchange_strong(*__e, __d, __s, __f); } +#if _LIBCPP_STD_VER >= 20 + // atomic_wait template <class _Tp> @@ -462,29 +466,27 @@ atomic_wait_explicit(const atomic<_Tp>* __o, typename atomic<_Tp>::value_type __ // atomic_notify_one template <class _Tp> -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT { __o->notify_one(); } template <class _Tp> -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT { __o->notify_one(); } // atomic_notify_all template <class _Tp> -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT { __o->notify_all(); } template <class _Tp> -_LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void -atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT { +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT { __o->notify_all(); } +#endif // _LIBCPP_STD_VER >= 20 + // atomic_fetch_add template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h index 7e26434c9c3..93f5c4cff0d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_base.h @@ -101,6 +101,7 @@ struct __atomic_base // false return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m); } +#if _LIBCPP_STD_VER >= 20 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { std::__atomic_wait(*this, __v, __m); @@ -117,6 +118,7 @@ struct __atomic_base // false std::__atomic_notify_all(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } +#endif // _LIBCPP_STD_VER >= 20 #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h index 00b157cdff7..abebfc112cb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_flag.h @@ -48,26 +48,24 @@ struct atomic_flag { __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void - wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT { +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const + volatile _NOEXCEPT { std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { - std::__atomic_notify_one(*this); - } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { std::__atomic_notify_all(*this); } - _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { - std::__atomic_notify_all(*this); - } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } +#endif #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {} @@ -144,45 +142,45 @@ inline _LIBCPP_HIDE_FROM_ABI void atomic_flag_clear_explicit(atomic_flag* __o, m __o->clear(__m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +#if _LIBCPP_STD_VER >= 20 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT { __o->wait(__v); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT { __o->wait(__v); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait_explicit(const volatile atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT { __o->wait(__v, __m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_wait_explicit(const atomic_flag* __o, bool __v, memory_order __m) _NOEXCEPT { __o->wait(__v, __m); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_one(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void -atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT { __o->notify_one(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT { __o->notify_all(); } -inline _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void -atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC void atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT { __o->notify_all(); } +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_ref.h b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_ref.h index a63a95c4ddd..301d42b172b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_ref.h +++ b/contrib/libs/cxxsupp/libcxx/include/__atomic/atomic_ref.h @@ -20,6 +20,7 @@ #include <__assert> #include <__atomic/atomic_sync.h> #include <__atomic/check_memory_order.h> +#include <__atomic/memory_order.h> #include <__atomic/to_gcc_order.h> #include <__concepts/arithmetic.h> #include <__concepts/same_as.h> @@ -57,11 +58,6 @@ struct __get_aligner_instance { template <class _Tp> struct __atomic_ref_base { -protected: - _Tp* __ptr_; - - _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {} - private: _LIBCPP_HIDE_FROM_ABI static _Tp* __clear_padding(_Tp& __val) noexcept { _Tp* __ptr = std::addressof(__val); @@ -108,10 +104,14 @@ private: friend struct __atomic_waitable_traits<__atomic_ref_base<_Tp>>; + // require types that are 1, 2, 4, 8, or 16 bytes in length to be aligned to at least their size to be potentially + // used lock-free + static constexpr size_t __min_alignment = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || (sizeof(_Tp) > 16) ? 0 : sizeof(_Tp); + public: using value_type = _Tp; - static constexpr size_t required_alignment = alignof(_Tp); + static constexpr size_t required_alignment = alignof(_Tp) > __min_alignment ? alignof(_Tp) : __min_alignment; // The __atomic_always_lock_free builtin takes into account the alignment of the pointer if provided, // so we create a fake pointer with a suitable alignment when querying it. Note that we are guaranteed @@ -218,6 +218,12 @@ public: } _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); } _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); } + +protected: + using _Aligned_Tp [[__gnu__::__aligned__(required_alignment)]] = _Tp; + _Aligned_Tp* __ptr_; + + _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {} }; template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h index cd045673817..735025065a7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_CXX03_LANG template <class _ToType, class _FromType> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept { return __builtin_bit_cast(_ToType, __from); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h b/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h index 998a0b44c19..bb09e8e5b58 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h @@ -27,15 +27,15 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long long __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h b/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h index 9e92021fba3..2f7571133bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h @@ -26,20 +26,20 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); } template <class _Tp> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero(_Tp __t) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero(_Tp __t) _NOEXCEPT { #if __has_builtin(__builtin_ctzg) return __builtin_ctzg(__t, numeric_limits<_Tp>::digits); #else // __has_builtin(__builtin_ctzg) diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/rotate.h b/contrib/libs/cxxsupp/libcxx/include/__bit/rotate.h index d848056c335..d79d98de296 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/rotate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/rotate.h @@ -20,24 +20,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// Writing two full functions for rotl and rotr makes it easier for the compiler +// to optimize the code. On x86 this function becomes the ROL instruction and +// the rotr function becomes the ROR instruction. template <class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __t, int __cnt) _NOEXCEPT { - static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); - const unsigned int __dig = numeric_limits<_Tp>::digits; - if ((__cnt % __dig) == 0) - return __t; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __x, int __s) _NOEXCEPT { + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires an unsigned integer type"); + const int __n = numeric_limits<_Tp>::digits; + int __r = __s % __n; + + if (__r == 0) + return __x; - if (__cnt < 0) { - __cnt *= -1; - return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); // rotr with negative __cnt is similar to rotl - } + if (__r > 0) + return (__x << __r) | (__x >> (__n - __r)); - return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig))); + return (__x >> -__r) | (__x << (__n + __r)); } template <class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __t, int __cnt) _NOEXCEPT { - return std::__rotr(__t, -__cnt); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __x, int __s) _NOEXCEPT { + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); + const int __n = numeric_limits<_Tp>::digits; + int __r = __s % __n; + + if (__r == 0) + return __x; + + if (__r > 0) + return (__x >> __r) | (__x << (__n - __r)); + + return (__x << -__r) | (__x >> (__n + __r)); } #if _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit_reference b/contrib/libs/cxxsupp/libcxx/include/__bit_reference index 606069d98be..22637d43974 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit_reference +++ b/contrib/libs/cxxsupp/libcxx/include/__bit_reference @@ -16,6 +16,7 @@ #include <__bit/countr.h> #include <__bit/invert_if.h> #include <__bit/popcount.h> +#include <__compare/ordering.h> #include <__config> #include <__fwd/bit_reference.h> #include <__iterator/iterator_traits.h> @@ -913,6 +914,7 @@ public: return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_; } +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x == __y); @@ -937,6 +939,18 @@ public: operator>=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x < __y); } +#else // _LIBCPP_STD_VER <= 17 + _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering + operator<=>(const __bit_iterator& __x, const __bit_iterator& __y) { + if (__x.__seg_ < __y.__seg_) + return strong_ordering::less; + + if (__x.__seg_ == __y.__seg_) + return __x.__ctz_ <=> __y.__ctz_; + + return strong_ordering::greater; + } +#endif // _LIBCPP_STD_VER <= 17 private: _LIBCPP_HIDE_FROM_ABI diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h index 0369f4dfb9b..ccb5856df17 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_integral.h @@ -21,6 +21,7 @@ #include <__system_error/errc.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_same.h> #include <__type_traits/make_32_64_or_128_bit.h> #include <__type_traits/make_unsigned.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_tm.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_tm.h index 881a4970822..3a51019b807 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_tm.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_tm.h @@ -29,11 +29,13 @@ #include <__chrono/year_month.h> #include <__chrono/year_month_day.h> #include <__chrono/year_month_weekday.h> +#include <__chrono/zoned_time.h> #include <__concepts/same_as.h> #include <__config> #include <__format/format_error.h> #include <__memory/addressof.h> #include <__type_traits/is_convertible.h> +#include <__type_traits/is_specialization.h> #include <cstdint> #include <ctime> #include <limits> @@ -178,7 +180,13 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) { // Has no time information. } else if constexpr (same_as<_ChronoT, chrono::local_info>) { // Has no time information. -# endif +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ + !defined(_LIBCPP_HAS_NO_LOCALIZATION) + } else if constexpr (__is_specialization_v<_ChronoT, chrono::zoned_time>) { + return std::__convert_to_tm<_Tm>( + chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()}); +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) } else static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization"); diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h index 7342084b08c..f5b14689a78 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/day.h @@ -11,8 +11,8 @@ #define _LIBCPP___CHRONO_DAY_H #include <__chrono/duration.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/exception.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/exception.h index 266f8fac441..cc408d78a36 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/exception.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/exception.h @@ -71,7 +71,7 @@ private: }; template <class _Duration> -_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time( +[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time( [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw nonexistent_local_time(__time, __info); @@ -115,7 +115,7 @@ private: }; template <class _Duration> -_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time( +[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time( [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw ambiguous_local_time(__time, __info); diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/formatter.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/formatter.h index e9b81c3de8a..8389e2cbf9e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/formatter.h @@ -10,52 +10,59 @@ #ifndef _LIBCPP___CHRONO_FORMATTER_H #define _LIBCPP___CHRONO_FORMATTER_H -#include <__algorithm/ranges_copy.h> -#include <__chrono/calendar.h> -#include <__chrono/concepts.h> -#include <__chrono/convert_to_tm.h> -#include <__chrono/day.h> -#include <__chrono/duration.h> -#include <__chrono/file_clock.h> -#include <__chrono/hh_mm_ss.h> -#include <__chrono/local_info.h> -#include <__chrono/month.h> -#include <__chrono/month_weekday.h> -#include <__chrono/monthday.h> -#include <__chrono/ostream.h> -#include <__chrono/parser_std_format_spec.h> -#include <__chrono/statically_widen.h> -#include <__chrono/sys_info.h> -#include <__chrono/system_clock.h> -#include <__chrono/time_point.h> -#include <__chrono/weekday.h> -#include <__chrono/year.h> -#include <__chrono/year_month.h> -#include <__chrono/year_month_day.h> -#include <__chrono/year_month_weekday.h> -#include <__concepts/arithmetic.h> -#include <__concepts/same_as.h> #include <__config> -#include <__format/concepts.h> -#include <__format/format_error.h> -#include <__format/format_functions.h> -#include <__format/format_parse_context.h> -#include <__format/formatter.h> -#include <__format/parser_std_format_spec.h> -#include <__format/write_escaped.h> -#include <__memory/addressof.h> -#include <cmath> -#include <ctime> -#include <sstream> -#include <string_view> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#ifndef _LIBCPP_HAS_NO_LOCALIZATION + +# include <__algorithm/ranges_copy.h> +# include <__chrono/calendar.h> +# include <__chrono/concepts.h> +# include <__chrono/convert_to_tm.h> +# include <__chrono/day.h> +# include <__chrono/duration.h> +# include <__chrono/file_clock.h> +# include <__chrono/hh_mm_ss.h> +# include <__chrono/local_info.h> +# include <__chrono/month.h> +# include <__chrono/month_weekday.h> +# include <__chrono/monthday.h> +# include <__chrono/ostream.h> +# include <__chrono/parser_std_format_spec.h> +# include <__chrono/statically_widen.h> +# include <__chrono/sys_info.h> +# include <__chrono/system_clock.h> +# include <__chrono/time_point.h> +# include <__chrono/weekday.h> +# include <__chrono/year.h> +# include <__chrono/year_month.h> +# include <__chrono/year_month_day.h> +# include <__chrono/year_month_weekday.h> +# include <__chrono/zoned_time.h> +# include <__concepts/arithmetic.h> +# include <__concepts/same_as.h> +# include <__format/concepts.h> +# include <__format/format_error.h> +# include <__format/format_functions.h> +# include <__format/format_parse_context.h> +# include <__format/formatter.h> +# include <__format/parser_std_format_spec.h> +# include <__format/write_escaped.h> +# include <__memory/addressof.h> +# include <__type_traits/is_specialization.h> +# include <cmath> +# include <ctime> +# include <limits> +# include <locale> +# include <sstream> +# include <string_view> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 namespace __formatter { @@ -136,10 +143,24 @@ __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss< __value.fractional_width); } +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \ + !defined(_LIBCPP_HAS_NO_FILESYSTEM) +template <class _CharT, class _Duration, class _TimeZonePtr> +_LIBCPP_HIDE_FROM_ABI void +__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) { + __formatter::__format_sub_seconds(__sstr, __value.get_local_time().time_since_epoch()); +} +# endif + template <class _Tp> consteval bool __use_fraction() { if constexpr (__is_time_point<_Tp>) return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width; +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \ + !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width; +# endif else if constexpr (chrono::__is_duration<_Tp>::value) return chrono::hh_mm_ss<_Tp>::fractional_width; else if constexpr (__is_hh_mm_ss<_Tp>) @@ -208,11 +229,15 @@ struct _LIBCPP_HIDE_FROM_ABI __time_zone { template <class _Tp> _LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const _Tp& __value) { -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) if constexpr (same_as<_Tp, chrono::sys_info>) return {__value.abbrev, __value.offset}; +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return __formatter::__convert_to_time_zone(__value.get_info()); +# endif else -# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) return {"UTC", chrono::seconds{0}}; } @@ -319,12 +344,12 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs( // // TODO FMT evaluate the comment above. -# if defined(__GLIBC__) || defined(_AIX) || defined(_WIN32) +# if defined(__GLIBC__) || defined(_AIX) || defined(_WIN32) case _CharT('y'): // Glibc fails for negative values, AIX for positive values too. __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), (std::abs(__t.tm_year + 1900)) % 100); break; -# endif // defined(__GLIBC__) || defined(_AIX) || defined(_WIN32) +# endif // defined(__GLIBC__) || defined(_AIX) || defined(_WIN32) case _CharT('Y'): // Depending on the platform's libc the range of supported years is @@ -420,12 +445,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) { return __value.weekday().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) return true; -# endif +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return true; +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -466,12 +495,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) { return __value.weekday().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) return true; -# endif +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return true; +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -512,12 +545,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) { return __value.ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) return true; -# endif +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return true; +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -558,12 +595,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) { return __value.month().ok(); else if constexpr (__is_hh_mm_ss<_Tp>) return true; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else if constexpr (same_as<_Tp, chrono::sys_info>) return true; else if constexpr (same_as<_Tp, chrono::local_info>) return true; -# endif +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) + else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>) + return true; +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -589,9 +630,16 @@ __format_chrono(const _Tp& __value, __sstr << __value; else { if constexpr (chrono::__is_duration<_Tp>::value) { - if (__value < __value.zero()) - __sstr << _CharT('-'); - __formatter::__format_chrono_using_chrono_specs(__sstr, chrono::abs(__value), __chrono_specs); + // A duration can be a user defined arithmetic type. Users may specialize + // numeric_limits, but they may not specialize is_signed. + if constexpr (numeric_limits<typename _Tp::rep>::is_signed) { + if (__value < __value.zero()) { + __sstr << _CharT('-'); + __formatter::__format_chrono_using_chrono_specs(__sstr, -__value, __chrono_specs); + } else + __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs); + } else + __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs); // TODO FMT When keeping the precision it will truncate the string. // Note that the behaviour what the precision does isn't specified. __specs.__precision_ = -1; @@ -894,7 +942,7 @@ public: } }; -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) template <__fmt_char_type _CharT> struct formatter<chrono::sys_info, _CharT> : public __formatter_chrono<_CharT> { public: @@ -916,10 +964,26 @@ public: return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags{}); } }; -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) +// Note due to how libc++'s formatters are implemented there is no need to add +// the exposition only local-time-format-t abstraction. +template <class _Duration, class _TimeZonePtr, __fmt_char_type _CharT> +struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public __formatter_chrono<_CharT> { +public: + using _Base = __formatter_chrono<_CharT>; + + template <class _ParseContext> + _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { + return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock); + } +}; +# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) -#endif // if _LIBCPP_STD_VER >= 20 +# endif // if _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_HAS_NO_LOCALIZATION + #endif // _LIBCPP___CHRONO_FORMATTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/leap_second.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/leap_second.h index 1a0e7f3107d..b01d9fbca8c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/leap_second.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/leap_second.h @@ -43,81 +43,86 @@ public: _LIBCPP_HIDE_FROM_ABI leap_second(const leap_second&) = default; _LIBCPP_HIDE_FROM_ABI leap_second& operator=(const leap_second&) = default; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr sys_seconds date() const noexcept { return __date_; } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sys_seconds date() const noexcept { return __date_; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr seconds value() const noexcept { return __value_; } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr seconds value() const noexcept { return __value_; } private: sys_seconds __date_; seconds __value_; -}; -_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const leap_second& __x, const leap_second& __y) { - return __x.date() == __y.date(); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) { - return __x.date() <=> __y.date(); -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) { - return __x.date() == __y; -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) { - return __x.date() < __y; -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) { - return __x < __y.date(); -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) { - return __y < __x; -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) { - return __y < __x; -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) { - return !(__y < __x); -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) { - return !(__y < __x); -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) { - return !(__x < __y); -} - -template <class _Duration> -_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) { - return !(__x < __y); -} - -# ifndef _LIBCPP_COMPILER_GCC -// This requirement cause a compilation loop in GCC-13 and running out of memory. -// TODO TZDB Test whether GCC-14 fixes this. -template <class _Duration> - requires three_way_comparable_with<sys_seconds, sys_time<_Duration>> -_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) { - return __x.date() <=> __y; -} -# endif + // The function + // template<class Duration> + // requires three_way_comparable_with<sys_seconds, sys_time<Duration>> + // constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept; + // + // Has constraints that are recursive (LWG4139). The proposed resolution is + // to make the funcion a hidden friend. For consistency make this change for + // all comparison functions. + + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const leap_second& __y) { + return __x.date() == __y.date(); + } + + _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) { + return __x.date() <=> __y.date(); + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) { + return __x.date() == __y; + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) { + return __x.date() < __y; + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) { + return __x < __y.date(); + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) { + return __y < __x; + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) { + return __y < __x; + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) { + return !(__y < __x); + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) { + return !(__y < __x); + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) { + return !(__x < __y); + } + + template <class _Duration> + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) { + return !(__x < __y); + } + + template <class _Duration> + requires three_way_comparable_with<sys_seconds, sys_time<_Duration>> + _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) { + return __x.date() <=> __y; + } +}; } // namespace chrono -# endif //_LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/month.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/month.h index ce5cc21aab7..77c67d0954e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/month.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/month.h @@ -11,8 +11,8 @@ #define _LIBCPP___CHRONO_MONTH_H #include <__chrono/duration.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/monthday.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/monthday.h index a89d16e5186..57712cf0b65 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/monthday.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/monthday.h @@ -13,8 +13,8 @@ #include <__chrono/calendar.h> #include <__chrono/day.h> #include <__chrono/month.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h index bb0341bc3ec..3420fb12bcd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/ostream.h @@ -10,36 +10,41 @@ #ifndef _LIBCPP___CHRONO_OSTREAM_H #define _LIBCPP___CHRONO_OSTREAM_H -#include <__chrono/calendar.h> -#include <__chrono/day.h> -#include <__chrono/duration.h> -#include <__chrono/file_clock.h> -#include <__chrono/hh_mm_ss.h> -#include <__chrono/local_info.h> -#include <__chrono/month.h> -#include <__chrono/month_weekday.h> -#include <__chrono/monthday.h> -#include <__chrono/statically_widen.h> -#include <__chrono/sys_info.h> -#include <__chrono/system_clock.h> -#include <__chrono/weekday.h> -#include <__chrono/year.h> -#include <__chrono/year_month.h> -#include <__chrono/year_month_day.h> -#include <__chrono/year_month_weekday.h> -#include <__concepts/same_as.h> #include <__config> -#include <__format/format_functions.h> -#include <__fwd/ostream.h> -#include <ratio> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +#ifndef _LIBCPP_HAS_NO_LOCALIZATION + +# include <__chrono/calendar.h> +# include <__chrono/day.h> +# include <__chrono/duration.h> +# include <__chrono/file_clock.h> +# include <__chrono/hh_mm_ss.h> +# include <__chrono/local_info.h> +# include <__chrono/month.h> +# include <__chrono/month_weekday.h> +# include <__chrono/monthday.h> +# include <__chrono/statically_widen.h> +# include <__chrono/sys_info.h> +# include <__chrono/system_clock.h> +# include <__chrono/weekday.h> +# include <__chrono/year.h> +# include <__chrono/year_month.h> +# include <__chrono/year_month_day.h> +# include <__chrono/year_month_weekday.h> +# include <__chrono/zoned_time.h> +# include <__concepts/same_as.h> +# include <__format/format_functions.h> +# include <__fwd/ostream.h> +# include <ratio> +# include <sstream> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 namespace chrono { @@ -81,11 +86,11 @@ _LIBCPP_HIDE_FROM_ABI auto __units_suffix() { else if constexpr (same_as<typename _Period::type, nano>) return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns"); else if constexpr (same_as<typename _Period::type, micro>) -# ifndef _LIBCPP_HAS_NO_UNICODE +# ifndef _LIBCPP_HAS_NO_UNICODE return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s"); -# else +# else return _LIBCPP_STATICALLY_WIDEN(_CharT, "us"); -# endif +# endif else if constexpr (same_as<typename _Period::type, milli>) return _LIBCPP_STATICALLY_WIDEN(_CharT, "ms"); else if constexpr (same_as<typename _Period::type, centi>) @@ -264,7 +269,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms); } -# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& @@ -302,12 +307,21 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const local_info& __info) { _LIBCPP_STATICALLY_WIDEN(_CharT, "{}: {{{}, {}}}"), __result(), __info.first, __info.second); } -# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) +template <class _CharT, class _Traits, class _Duration, class _TimeZonePtr> +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _TimeZonePtr>& __tp) { + return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T %Z}"), __tp); +} +# endif +# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) } // namespace chrono -#endif // if _LIBCPP_STD_VER >= 20 +# endif // if _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_HAS_NO_LOCALIZATION + #endif // _LIBCPP___CHRONO_OSTREAM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h index 785bbae198e..c9cfcc6d572 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/parser_std_format_spec.h @@ -11,20 +11,23 @@ #define _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H #include <__config> -#include <__format/concepts.h> -#include <__format/format_error.h> -#include <__format/format_parse_context.h> -#include <__format/formatter_string.h> -#include <__format/parser_std_format_spec.h> -#include <string_view> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__format/concepts.h> +# include <__format/format_error.h> +# include <__format/format_parse_context.h> +# include <__format/formatter_string.h> +# include <__format/parser_std_format_spec.h> +# include <string_view> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 namespace __format_spec { @@ -409,8 +412,10 @@ private: } // namespace __format_spec -#endif //_LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #endif // _LIBCPP___CHRONO_PARSER_STD_FORMAT_SPEC_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/statically_widen.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/statically_widen.h index a18c46f057a..680483a59ac 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/statically_widen.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/statically_widen.h @@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __s # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str) # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h index b2d365c5fd0..7b15f6ae392 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/time_zone_link.h @@ -68,7 +68,7 @@ operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept { } // namespace chrono -# endif //_LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h index f731f8c318b..dce97c3adfa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb.h @@ -21,7 +21,10 @@ # include <__chrono/time_zone.h> # include <__chrono/time_zone_link.h> # include <__config> +# include <__memory/addressof.h> +# include <stdexcept> # include <string> +# include <string_view> # include <vector> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h index aeef4fe1aba..18446d9926d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/tzdb_list.h @@ -21,6 +21,7 @@ # include <__config> # include <__fwd/string.h> # include <forward_list> +# include <string_view> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/weekday.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/weekday.h index 5a7dedc6e3a..86c780cc718 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/weekday.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/weekday.h @@ -79,6 +79,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, con return __lhs.c_encoding() == __rhs.c_encoding(); } +// TODO(LLVM 20): Remove the escape hatch +# ifdef _LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(const weekday& __lhs, const weekday& __rhs) noexcept { return __lhs.c_encoding() < __rhs.c_encoding(); } @@ -94,6 +96,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(const weekday& __lhs, con _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept { return !(__lhs < __rhs); } +# endif // _LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept { auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/year.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/year.h index 1899d09f38d..2ae5180cb8f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/year.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/year.h @@ -11,8 +11,8 @@ #define _LIBCPP___CHRONO_YEAR_H #include <__chrono/duration.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month.h index 369ea38f756..cf9234bdb46 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month.h @@ -13,8 +13,8 @@ #include <__chrono/duration.h> #include <__chrono/month.h> #include <__chrono/year.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month_day.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month_day.h index 75884f3654d..a0510a14f4e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month_day.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/year_month_day.h @@ -19,8 +19,8 @@ #include <__chrono/time_point.h> #include <__chrono/year.h> #include <__chrono/year_month.h> +#include <__compare/ordering.h> #include <__config> -#include <compare> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -239,33 +239,11 @@ operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) n return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last(); } -_LIBCPP_HIDE_FROM_ABI inline constexpr bool -operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { - return !(__lhs == __rhs); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr bool -operator<(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { - if (__lhs.year() < __rhs.year()) - return true; - if (__lhs.year() > __rhs.year()) - return false; - return __lhs.month_day_last() < __rhs.month_day_last(); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr bool -operator>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { - return __rhs < __lhs; -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr bool -operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { - return !(__rhs < __lhs); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr bool -operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { - return !(__lhs < __rhs); +_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering +operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept { + if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0) + return __c; + return __lhs.month_day_last() <=> __rhs.month_day_last(); } _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept { diff --git a/contrib/libs/cxxsupp/libcxx/include/__chrono/zoned_time.h b/contrib/libs/cxxsupp/libcxx/include/__chrono/zoned_time.h index c6084426ad7..c7252cb003b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__chrono/zoned_time.h +++ b/contrib/libs/cxxsupp/libcxx/include/__chrono/zoned_time.h @@ -16,15 +16,28 @@ // Enable the contents of the header only when libc++ was built with experimental features enabled. #if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) +# include <__chrono/calendar.h> +# include <__chrono/duration.h> +# include <__chrono/sys_info.h> +# include <__chrono/system_clock.h> # include <__chrono/time_zone.h> # include <__chrono/tzdb_list.h> +# include <__concepts/constructible.h> # include <__config> -# include <__fwd/string_view.h> +# include <__type_traits/common_type.h> +# include <__type_traits/conditional.h> +# include <__type_traits/remove_cvref.h> +# include <__utility/declval.h> +# include <__utility/move.h> +# include <string_view> # 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 >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ @@ -43,6 +56,165 @@ struct zoned_traits<const time_zone*> { } }; +template <class _Duration, class _TimeZonePtr = const time_zone*> +class zoned_time { + // [time.zone.zonedtime.ctor]/2 + static_assert(__is_duration<_Duration>::value, + "the program is ill-formed since _Duration is not a specialization of std::chrono::duration"); + + // The wording uses the constraints like + // constructible_from<zoned_time, decltype(__traits::locate_zone(string_view{}))> + // Using these constraints in the code causes the compiler to give an + // error that the constraint depends on itself. To avoid that issue use + // the fact it is possible to create this object from a _TimeZonePtr. + using __traits = zoned_traits<_TimeZonePtr>; + +public: + using duration = common_type_t<_Duration, seconds>; + + _LIBCPP_HIDE_FROM_ABI zoned_time() + requires requires { __traits::default_zone(); } + : __zone_{__traits::default_zone()}, __tp_{} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time&) = default; + _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const zoned_time&) = default; + + _LIBCPP_HIDE_FROM_ABI zoned_time(const sys_time<_Duration>& __tp) + requires requires { __traits::default_zone(); } + : __zone_{__traits::default_zone()}, __tp_{__tp} {} + + _LIBCPP_HIDE_FROM_ABI explicit zoned_time(_TimeZonePtr __zone) : __zone_{std::move(__zone)}, __tp_{} {} + + _LIBCPP_HIDE_FROM_ABI explicit zoned_time(string_view __name) + requires(requires { __traits::locate_zone(string_view{}); } && + constructible_from<_TimeZonePtr, decltype(__traits::locate_zone(string_view{}))>) + : __zone_{__traits::locate_zone(__name)}, __tp_{} {} + + template <class _Duration2> + _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time<_Duration2, _TimeZonePtr>& __zt) + requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>> + : __zone_{__zt.get_time_zone()}, __tp_{__zt.get_sys_time()} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const sys_time<_Duration>& __tp) + : __zone_{std::move(__zone)}, __tp_{__tp} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const sys_time<_Duration>& __tp) + requires requires { _TimeZonePtr{__traits::locate_zone(string_view{})}; } + : zoned_time{__traits::locate_zone(__name), __tp} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp) + requires(is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})), + sys_time<duration>>) + : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp)} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp) + requires(requires { + _TimeZonePtr{__traits::locate_zone(string_view{})}; + } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})), + sys_time<duration>>) + : zoned_time{__traits::locate_zone(__name), __tp} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp, choose __c) + requires(is_convertible_v< + decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)), + sys_time<duration>>) + : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp, __c)} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp, choose __c) + requires(requires { + _TimeZonePtr{__traits::locate_zone(string_view{})}; + } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)), + sys_time<duration>>) + : zoned_time{__traits::locate_zone(__name), __tp, __c} {} + + template <class _Duration2, class _TimeZonePtr2> + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt) + requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>> + : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {} + + // per wording choose has no effect + template <class _Duration2, class _TimeZonePtr2> + _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose) + requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>> + : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {} + + template <class _Duration2, class _TimeZonePtr2> + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt) + requires(requires { + _TimeZonePtr{__traits::locate_zone(string_view{})}; + } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>) + : zoned_time{__traits::locate_zone(__name), __zt} {} + + template <class _Duration2, class _TimeZonePtr2> + _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose __c) + requires(requires { + _TimeZonePtr{__traits::locate_zone(string_view{})}; + } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>) + : zoned_time{__traits::locate_zone(__name), __zt, __c} {} + + _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const sys_time<_Duration>& __tp) { + __tp_ = __tp; + return *this; + } + + _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const local_time<_Duration>& __tp) { + // TODO TZDB This seems wrong. + // Assigning a non-existent or ambiguous time will throw and not satisfy + // the post condition. This seems quite odd; I constructed an object with + // choose::earliest and that choice is not respected. + // what did LEWG do with this. + // MSVC STL and libstdc++ behave the same + __tp_ = __zone_->to_sys(__tp); + return *this; + } + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI operator sys_time<duration>() const { return get_sys_time(); } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit operator local_time<duration>() const { return get_local_time(); } + + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _TimeZonePtr get_time_zone() const { return __zone_; } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<duration> get_local_time() const { return __zone_->to_local(__tp_); } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<duration> get_sys_time() const { return __tp_; } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_info get_info() const { return __zone_->get_info(__tp_); } + +private: + _TimeZonePtr __zone_; + sys_time<duration> __tp_; +}; + +zoned_time() -> zoned_time<seconds>; + +template <class _Duration> +zoned_time(sys_time<_Duration>) -> zoned_time<common_type_t<_Duration, seconds>>; + +template <class _TimeZonePtrOrName> +using __time_zone_representation = + conditional_t<is_convertible_v<_TimeZonePtrOrName, string_view>, + const time_zone*, + remove_cvref_t<_TimeZonePtrOrName>>; + +template <class _TimeZonePtrOrName> +zoned_time(_TimeZonePtrOrName&&) -> zoned_time<seconds, __time_zone_representation<_TimeZonePtrOrName>>; + +template <class _TimeZonePtrOrName, class _Duration> +zoned_time(_TimeZonePtrOrName&&, sys_time<_Duration>) + -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>; + +template <class _TimeZonePtrOrName, class _Duration> +zoned_time(_TimeZonePtrOrName&&, local_time<_Duration>, choose = choose::earliest) + -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>; + +template <class _Duration, class _TimeZonePtrOrName, class _TimeZonePtr2> +zoned_time(_TimeZonePtrOrName&&, zoned_time<_Duration, _TimeZonePtr2>, choose = choose::earliest) + -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>; + +using zoned_seconds = zoned_time<seconds>; + +template <class _Duration1, class _Duration2, class _TimeZonePtr> +_LIBCPP_HIDE_FROM_ABI bool +operator==(const zoned_time<_Duration1, _TimeZonePtr>& __lhs, const zoned_time<_Duration2, _TimeZonePtr>& __rhs) { + return __lhs.get_time_zone() == __rhs.get_time_zone() && __lhs.get_sys_time() == __rhs.get_sys_time(); +} + } // namespace chrono # endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) @@ -50,6 +222,8 @@ struct zoned_traits<const time_zone*> { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) #endif // _LIBCPP___CHRONO_ZONED_TIME_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/ordering.h b/contrib/libs/cxxsupp/libcxx/include/__compare/ordering.h index 2995d381304..297218e6f29 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__compare/ordering.h +++ b/contrib/libs/cxxsupp/libcxx/include/__compare/ordering.h @@ -24,32 +24,35 @@ _LIBCPP_BEGIN_NAMESPACE_STD // exposition only enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 }; -enum class _NCmpResult : signed char { __unordered = -127 }; +enum class _PartialOrdResult : signed char { + __less = static_cast<signed char>(_OrdResult::__less), + __equiv = static_cast<signed char>(_OrdResult::__equiv), + __greater = static_cast<signed char>(_OrdResult::__greater), + __unordered = -127, +}; class partial_ordering; class weak_ordering; class strong_ordering; -template <class _Tp, class... _Args> -inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...); - struct _CmpUnspecifiedParam { - _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {} - - template <class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>> - _CmpUnspecifiedParam(_Tp) = delete; + // If anything other than a literal 0 is provided, the behavior is undefined by the Standard. + // + // The alternative to the `__enable_if__` attribute would be to use the fact that a pointer + // can be constructed from literal 0, but this conflicts with `-Wzero-as-null-pointer-constant`. + template <class _Tp, class = __enable_if_t<is_same_v<_Tp, int> > > + _LIBCPP_HIDE_FROM_ABI consteval _CmpUnspecifiedParam(_Tp __zero) noexcept +# if __has_attribute(__enable_if__) + __attribute__((__enable_if__( + __zero == 0, "Only literal 0 is allowed as the operand of a comparison with one of the ordering types"))) +# endif + { + (void)__zero; + } }; class partial_ordering { - using _ValueT = signed char; - - _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {} - - _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_NCmpResult __v) noexcept : __value_(_ValueT(__v)) {} - - _LIBCPP_HIDE_FROM_ABI constexpr bool __is_ordered() const noexcept { - return __value_ != _ValueT(_NCmpResult::__unordered); - } + _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_PartialOrdResult __v) noexcept : __value_(__v) {} public: // valid values @@ -62,39 +65,39 @@ public: _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default; _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__is_ordered() && __v.__value_ == 0; + return __v.__value_ == _PartialOrdResult::__equiv; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__is_ordered() && __v.__value_ < 0; + return __v.__value_ == _PartialOrdResult::__less; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__is_ordered() && __v.__value_ <= 0; + return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__less; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__is_ordered() && __v.__value_ > 0; + return __v.__value_ == _PartialOrdResult::__greater; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__is_ordered() && __v.__value_ >= 0; + return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__greater; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__is_ordered() && 0 < __v.__value_; + return __v.__value_ == _PartialOrdResult::__greater; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__is_ordered() && 0 <= __v.__value_; + return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__greater; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__is_ordered() && 0 > __v.__value_; + return __v.__value_ == _PartialOrdResult::__less; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__is_ordered() && 0 >= __v.__value_; + return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__less; } _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering @@ -108,13 +111,13 @@ public: } private: - _ValueT __value_; + _PartialOrdResult __value_; }; -inline constexpr partial_ordering partial_ordering::less(_OrdResult::__less); -inline constexpr partial_ordering partial_ordering::equivalent(_OrdResult::__equiv); -inline constexpr partial_ordering partial_ordering::greater(_OrdResult::__greater); -inline constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__unordered); +inline constexpr partial_ordering partial_ordering::less(_PartialOrdResult::__less); +inline constexpr partial_ordering partial_ordering::equivalent(_PartialOrdResult::__equiv); +inline constexpr partial_ordering partial_ordering::greater(_PartialOrdResult::__greater); +inline constexpr partial_ordering partial_ordering::unordered(_PartialOrdResult::__unordered); class weak_ordering { using _ValueT = signed char; @@ -269,7 +272,8 @@ inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater) /// The types partial_ordering, weak_ordering, and strong_ordering are /// collectively termed the comparison category types. template <class _Tp> -concept __comparison_category = __one_of_v<_Tp, partial_ordering, weak_ordering, strong_ordering>; +concept __comparison_category = + is_same_v<_Tp, partial_ordering> || is_same_v<_Tp, weak_ordering> || is_same_v<_Tp, strong_ordering>; #endif // _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h b/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h index 00731efc8fc..e0263a878b0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__concepts/predicate.h @@ -12,7 +12,7 @@ #include <__concepts/boolean_testable.h> #include <__concepts/invocable.h> #include <__config> -#include <__functional/invoke.h> +#include <__type_traits/invoke.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 8ce18c110aa..8ea2c284c86 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -27,10 +27,11 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 190000 +# define _LIBCPP_VERSION 200000 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) +# define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z)) # if __STDC_HOSTED__ == 0 # define _LIBCPP_FREESTANDING @@ -38,10 +39,10 @@ // HARDENING { -// TODO(hardening): deprecate this in LLVM 19. // This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes) -// equivalent to setting the extensive mode. +// equivalent to setting the extensive mode. This is deprecated and will be removed in LLVM 20. # ifdef _LIBCPP_ENABLE_ASSERTIONS +# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_HARDENING_MODE instead" # if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 # error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" # endif @@ -162,16 +163,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_CXX03_LANG # endif -// TODO: Remove once we switch to GCC 14 -# ifndef __has_extension -# define __has_extension(__x) 0 -# endif - -// TODO: Remove once we switch to GCC 14 -# ifndef __has_feature -# define __has_feature(__x) 0 -# endif - # ifndef __has_constexpr_builtin # define __has_constexpr_builtin(x) 0 # endif @@ -201,25 +192,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" # endif -// FIXME: ABI detection should be done via compiler builtin macros. This -// is just a placeholder until Clang implements such macros. For now assume -// that Windows compilers pretending to be MSVC++ target the Microsoft ABI, -// and allow the user to explicitly specify the ABI to handle cases where this -// heuristic falls short. -# if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" -# elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -# elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -# else -# if defined(_WIN32) && defined(_MSC_VER) -# define _LIBCPP_ABI_MICROSOFT -# else -# define _LIBCPP_ABI_ITANIUM -# endif -# endif - # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) # define _LIBCPP_ABI_VCRUNTIME # endif @@ -234,7 +206,6 @@ _LIBCPP_HARDENING_MODE_DEBUG // easier to grep for target specific flags once the feature is complete. # if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_HAS_NO_INCOMPLETE_PSTL -# define _LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN # define _LIBCPP_HAS_NO_EXPERIMENTAL_TZDB # define _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM # endif @@ -322,7 +293,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) # define _ALIGNAS_TYPE(x) alignas(x) # define _ALIGNAS(x) alignas(x) -# define _LIBCPP_NORETURN [[noreturn]] # define _NOEXCEPT noexcept # define _NOEXCEPT_(...) noexcept(__VA_ARGS__) # define _LIBCPP_CONSTEXPR constexpr @@ -332,7 +302,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) # define _ALIGNAS(x) __attribute__((__aligned__(x))) -# define _LIBCPP_NORETURN __attribute__((__noreturn__)) # define _LIBCPP_HAS_NO_NOEXCEPT # define nullptr __nullptr # define _NOEXCEPT throw() @@ -348,44 +317,30 @@ typedef __char32_t char32_t; # define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) -# if defined(_LIBCPP_COMPILER_CLANG_BASED) - // Objective-C++ features (opt-in) -# if __has_feature(objc_arc) -# define _LIBCPP_HAS_OBJC_ARC -# endif - -# if __has_feature(objc_arc_weak) -# define _LIBCPP_HAS_OBJC_ARC_WEAK -# endif - -# if __has_extension(blocks) -# define _LIBCPP_HAS_EXTENSION_BLOCKS -# endif - -# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) -# define _LIBCPP_HAS_BLOCKS_RUNTIME -# endif - -# if !__has_feature(address_sanitizer) -# define _LIBCPP_HAS_NO_ASAN -# endif - -# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) +# if __has_feature(objc_arc) +# define _LIBCPP_HAS_OBJC_ARC +# endif -# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# if __has_feature(objc_arc_weak) +# define _LIBCPP_HAS_OBJC_ARC_WEAK +# endif -# elif defined(_LIBCPP_COMPILER_GCC) +# if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +# endif -# if !defined(__SANITIZE_ADDRESS__) -# define _LIBCPP_HAS_NO_ASAN -# endif +# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) +# define _LIBCPP_HAS_BLOCKS_RUNTIME +# endif -# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) +# if !__has_feature(address_sanitizer) +# define _LIBCPP_HAS_NO_ASAN +# endif -# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -# endif // _LIBCPP_COMPILER_[CLANG|GCC] +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ # if defined(_LIBCPP_OBJECT_FORMAT_COFF) @@ -617,6 +572,15 @@ typedef __char32_t char32_t; inline namespace _LIBCPP_ABI_NAMESPACE { # define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_POP_EXTENSION_DIAGNOSTICS +#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental { +#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL }} + +#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { +#define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL + +#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 { +#define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL + #ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem { # define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD @@ -723,14 +687,6 @@ typedef __char32_t char32_t; # define _LIBCPP_DEPRECATED_(m) # endif -# if _LIBCPP_STD_VER < 20 -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC \ - _LIBCPP_DEPRECATED_("The C++20 synchronization library has been deprecated prior to C++20. Please update to " \ - "using -std=c++20 if you need to use these facilities.") -# else -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC /* nothing */ -# endif - # if !defined(_LIBCPP_CXX03_LANG) # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED # else @@ -820,6 +776,12 @@ typedef __char32_t char32_t; # define _LIBCPP_CONSTEXPR_SINCE_CXX23 # endif +# if _LIBCPP_STD_VER >= 26 +# define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX26 +# endif + # ifndef _LIBCPP_WEAK # define _LIBCPP_WEAK __attribute__((__weak__)) # endif @@ -915,7 +877,7 @@ typedef __char32_t char32_t; # endif # if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ - defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) + defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__LLVM_LIBC__) # define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE # endif @@ -1024,21 +986,9 @@ typedef __char32_t char32_t; // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) // However, MSVC implements [[msvc::no_unique_address]] which does what // [[no_unique_address]] is supposed to do, in general. - -// Clang-cl does not yet (14.0) implement either [[no_unique_address]] or -// [[msvc::no_unique_address]] though. If/when it does implement -// [[msvc::no_unique_address]], this should be preferred though. # define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] -# elif __has_cpp_attribute(no_unique_address) -# define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]] # else -# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ -// Note that this can be replaced by #error as soon as clang-cl -// implements msvc::no_unique_address, since there should be no C++20 -// compiler that doesn't support one of the two attributes at that point. -// We generally don't want to use this macro outside of C++20-only code, -// because using it conditionally in one language version only would make -// the ABI inconsistent. +# define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]] # endif // c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these @@ -1149,15 +1099,6 @@ typedef __char32_t char32_t; # define _LIBCPP_USING_IF_EXISTS # endif -# if __has_cpp_attribute(__nodiscard__) -# define _LIBCPP_NODISCARD [[__nodiscard__]] -# else -// We can't use GCC's [[gnu::warn_unused_result]] and -// __attribute__((warn_unused_result)), because GCC does not silence them via -// (void) cast. -# define _LIBCPP_NODISCARD -# endif - # if __has_attribute(__no_destroy__) # define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) # else diff --git a/contrib/libs/cxxsupp/libcxx/include/__config_site b/contrib/libs/cxxsupp/libcxx/include/__config_site index ecd7ae4d278..61cf47ac440 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config_site +++ b/contrib/libs/cxxsupp/libcxx/include/__config_site @@ -51,6 +51,8 @@ #define _LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE +#define _LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS + #ifdef _musl_ # define _LIBCPP_HAS_MUSL_LIBC #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__config_site.in b/contrib/libs/cxxsupp/libcxx/include/__config_site.in index 67022146c90..bf2d31d8eeb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config_site.in +++ b/contrib/libs/cxxsupp/libcxx/include/__config_site.in @@ -15,6 +15,7 @@ #cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT #cmakedefine _LIBCPP_HAS_NO_THREADS #cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK +#cmakedefine _LIBCPP_HAS_NO_TERMINAL #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL diff --git a/contrib/libs/cxxsupp/libcxx/include/__configuration/abi.h b/contrib/libs/cxxsupp/libcxx/include/__configuration/abi.h index c31fbbae1ac..1e4c9cf3a3f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__configuration/abi.h +++ b/contrib/libs/cxxsupp/libcxx/include/__configuration/abi.h @@ -18,6 +18,25 @@ # pragma GCC system_header #endif +// FIXME: ABI detection should be done via compiler builtin macros. This +// is just a placeholder until Clang implements such macros. For now assume +// that Windows compilers pretending to be MSVC++ target the Microsoft ABI, +// and allow the user to explicitly specify the ABI to handle cases where this +// heuristic falls short. +#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +#elif defined(_LIBCPP_ABI_FORCE_ITANIUM) +# define _LIBCPP_ABI_ITANIUM +#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# define _LIBCPP_ABI_MICROSOFT +#else +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif +#endif + #if _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. @@ -96,6 +115,20 @@ # define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW // Dont' add an inline namespace for `std::filesystem` # define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE +// std::basic_ios uses WEOF to indicate that the fill value is +// uninitialized. However, on platforms where the size of char_type is +// equal to or greater than the size of int_type and char_type is unsigned, +// std::char_traits<char_type>::eq_int_type() cannot distinguish between WEOF +// and WCHAR_MAX. This ABI setting determines whether we should instead track whether the fill +// value has been initialized using a separate boolean, which changes the ABI. +# define _LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE +// Historically, libc++ used a type called `__compressed_pair` to reduce storage needs in cases of empty types (e.g. an +// empty allocator in std::vector). We switched to using `[[no_unique_address]]`. However, for ABI compatibility reasons +// we had to add artificial padding in a few places. +// +// This setting disables the addition of such artificial padding, leading to a more optimal +// representation for several types. +# define _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING #elif _LIBCPP_ABI_VERSION == 1 # if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support @@ -135,6 +168,24 @@ // - `string_view`. // #define _LIBCPP_ABI_BOUNDED_ITERATORS +// Changes the iterator type of `basic_string` to a bounded iterator that keeps track of whether it's within the bounds +// of the original container and asserts it on every dereference and when performing iterator arithmetics. +// +// ABI impact: changes the iterator type of `basic_string` and its specializations, such as `string` and `wstring`. +// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING + +// Changes the iterator type of `vector` to a bounded iterator that keeps track of whether it's within the bounds of the +// original container and asserts it on every dereference and when performing iterator arithmetics. Note: this doesn't +// yet affect `vector<bool>`. +// +// ABI impact: changes the iterator type of `vector` (except `vector<bool>`). +// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR + +// [[msvc::no_unique_address]] seems to mostly affect empty classes, so the padding scheme for Itanium doesn't work. +#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING) +# define _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING +#endif + #if defined(_LIBCPP_COMPILER_CLANG_BASED) # if defined(__APPLE__) # if defined(__i386__) || defined(__x86_64__) diff --git a/contrib/libs/cxxsupp/libcxx/include/__configuration/platform.h b/contrib/libs/cxxsupp/libcxx/include/__configuration/platform.h index 6d5b95164e8..78ad402a68b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__configuration/platform.h +++ b/contrib/libs/cxxsupp/libcxx/include/__configuration/platform.h @@ -30,15 +30,18 @@ // ... add new file formats here ... #endif -// Need to detect which libc we're using if we're on Linux. -#if defined(__linux__) +// To detect which libc we're using +#if __has_include(<features.h>) # include <features.h> +#endif + +#if defined(__linux__) # if defined(__GLIBC_PREREQ) # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) # else # define _LIBCPP_GLIBC_PREREQ(a, b) 0 # endif // defined(__GLIBC_PREREQ) -#endif // defined(__linux__) +#endif #ifndef __BYTE_ORDER__ # error \ diff --git a/contrib/libs/cxxsupp/libcxx/include/__cstddef/byte.h b/contrib/libs/cxxsupp/libcxx/include/__cstddef/byte.h new file mode 100644 index 00000000000..09e1d75e0b4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__cstddef/byte.h @@ -0,0 +1,85 @@ +//===---------------------------------------------------------------------===// +// +// 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___CSTDDEF_BYTE_H +#define _LIBCPP___CSTDDEF_BYTE_H + +#include <__config> +#include <__fwd/byte.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_integral.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER >= 17 +namespace std { // purposefully not versioned + +enum class byte : unsigned char {}; + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept { + return static_cast<byte>( + static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs))); +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept { + return __lhs = __lhs | __rhs; +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept { + return static_cast<byte>( + static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs))); +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept { + return __lhs = __lhs & __rhs; +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept { + return static_cast<byte>( + static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs))); +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept { + return __lhs = __lhs ^ __rhs; +} + +_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept { + return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b))); +} + +template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift) noexcept { + return __lhs = __lhs << __shift; +} + +template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept { + return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); +} + +template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift) noexcept { + return __lhs = __lhs >> __shift; +} + +template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept { + return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); +} + +template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Integer to_integer(byte __b) noexcept { + return static_cast<_Integer>(__b); +} + +} // namespace std +#endif // _LIBCPP_STD_VER >= 17 + +#endif // _LIBCPP___CSTDDEF_BYTE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__cstddef/max_align_t.h b/contrib/libs/cxxsupp/libcxx/include/__cstddef/max_align_t.h new file mode 100644 index 00000000000..7c09c7e7f30 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__cstddef/max_align_t.h @@ -0,0 +1,27 @@ +//===---------------------------------------------------------------------===// +// +// 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___CSTDDEF_MAX_ALIGN_T_H +#define _LIBCPP___CSTDDEF_MAX_ALIGN_T_H + +#include <__config> +#include <stddef.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_CXX03_LANG) +using ::max_align_t _LIBCPP_USING_IF_EXISTS; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CSTDDEF_MAX_ALIGN_T_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__cstddef/nullptr_t.h b/contrib/libs/cxxsupp/libcxx/include/__cstddef/nullptr_t.h new file mode 100644 index 00000000000..de3f7d4ab5f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__cstddef/nullptr_t.h @@ -0,0 +1,25 @@ +//===---------------------------------------------------------------------===// +// +// 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___CSTDDEF_NULLPTR_T_H +#define _LIBCPP___CSTDDEF_NULLPTR_T_H + +#include <__config> +#include <stddef.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using ::nullptr_t; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CSTDDEF_NULLPTR_T_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__cstddef/ptrdiff_t.h b/contrib/libs/cxxsupp/libcxx/include/__cstddef/ptrdiff_t.h new file mode 100644 index 00000000000..f8b5cdaaff0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__cstddef/ptrdiff_t.h @@ -0,0 +1,25 @@ +//===---------------------------------------------------------------------===// +// +// 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___CSTDDEF_PTRDIFF_T_H +#define _LIBCPP___CSTDDEF_PTRDIFF_T_H + +#include <__config> +#include <stddef.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CSTDDEF_PTRDIFF_T_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__cstddef/size_t.h b/contrib/libs/cxxsupp/libcxx/include/__cstddef/size_t.h new file mode 100644 index 00000000000..91abbf01318 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__cstddef/size_t.h @@ -0,0 +1,25 @@ +//===---------------------------------------------------------------------===// +// +// 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___CSTDDEF_SIZE_T_H +#define _LIBCPP___CSTDDEF_SIZE_T_H + +#include <__config> +#include <stddef.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using ::size_t _LIBCPP_USING_IF_EXISTS; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CSTDDEF_SIZE_T_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h index e9316f31c22..fcf907411b1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__exception/exception_ptr.h @@ -138,7 +138,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { #else // _LIBCPP_ABI_MICROSOFT -_LIBCPP_HIDE_FROM_ABI exception_ptr __copy_exception_ptr(void* __exception, const void* __ptr); +_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr); // This is a built-in template function which automagically extracts the required // information. diff --git a/contrib/libs/cxxsupp/libcxx/include/__exception/nested_exception.h b/contrib/libs/cxxsupp/libcxx/include/__exception/nested_exception.h index feb489f87f6..8e817e1c069 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__exception/nested_exception.h +++ b/contrib/libs/cxxsupp/libcxx/include/__exception/nested_exception.h @@ -13,6 +13,8 @@ #include <__exception/exception_ptr.h> #include <__memory/addressof.h> #include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_base_of.h> #include <__type_traits/is_class.h> #include <__type_traits/is_constructible.h> @@ -38,7 +40,7 @@ public: virtual ~nested_exception() _NOEXCEPT; // access functions - _LIBCPP_NORETURN void rethrow_nested() const; + [[__noreturn__]] void rethrow_nested() const; _LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; } }; @@ -53,19 +55,19 @@ struct __throw_with_nested; template <class _Tp, class _Up> struct __throw_with_nested<_Tp, _Up, true> { - _LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { + [[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw __nested<_Up>(std::forward<_Tp>(__t)); } }; template <class _Tp, class _Up> struct __throw_with_nested<_Tp, _Up, false> { - _LIBCPP_NORETURN static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); } + [[__noreturn__]] static inline _LIBCPP_HIDE_FROM_ABI void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); } }; #endif template <class _Tp> -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) { +[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS using _Up = __decay_t<_Tp>; static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); diff --git a/contrib/libs/cxxsupp/libcxx/include/__exception/operations.h b/contrib/libs/cxxsupp/libcxx/include/__exception/operations.h index 0a9c7a7c7f0..c8744eb297a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__exception/operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__exception/operations.h @@ -22,20 +22,22 @@ namespace std { // purposefully not using versioning namespace using unexpected_handler = void (*)(); _LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected(); +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void unexpected(); #endif using terminate_handler = void (*)(); _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT; _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT; -_LIBCPP_EXPORTED_FROM_ABI bool uncaught_exception() _NOEXCEPT; +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION) +_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 bool uncaught_exception() _NOEXCEPT; +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION) _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT; class _LIBCPP_EXPORTED_FROM_ABI exception_ptr; _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); } // namespace std #endif // _LIBCPP___EXCEPTION_OPERATIONS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__exception/terminate.h b/contrib/libs/cxxsupp/libcxx/include/__exception/terminate.h index e672471dc52..0bfc3506d37 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__exception/terminate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__exception/terminate.h @@ -16,7 +16,7 @@ #endif namespace std { // purposefully not using versioning namespace -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT; +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT; } // namespace std #endif // _LIBCPP___EXCEPTION_TERMINATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h b/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h index d08222f7bcd..6e5745c7444 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h +++ b/contrib/libs/cxxsupp/libcxx/include/__expected/expected.h @@ -17,9 +17,11 @@ #include <__functional/invoke.h> #include <__memory/addressof.h> #include <__memory/construct_at.h> +#include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> #include <__type_traits/disjunction.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> @@ -503,25 +505,24 @@ public: private: template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual> - using __can_convert = - _And< is_constructible<_Tp, _UfQual>, - is_constructible<_Err, _OtherErrQual>, - _If<_Not<is_same<remove_cv_t<_Tp>, bool>>::value, - _And< - _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>, // use the copy constructor instead, see #92676 - _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>, - _Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>, - _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>, - _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>, - _Not<is_convertible<expected<_Up, _OtherErr>&, _Tp>>, - _Not<is_convertible<expected<_Up, _OtherErr>&&, _Tp>>, - _Not<is_convertible<const expected<_Up, _OtherErr>&, _Tp>>, - _Not<is_convertible<const expected<_Up, _OtherErr>&&, _Tp>>>, - true_type>, - _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>, - _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>, - _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>, - _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>> >; + using __can_convert = _And< + is_constructible<_Tp, _UfQual>, + is_constructible<_Err, _OtherErrQual>, + _If<_Not<is_same<remove_cv_t<_Tp>, bool>>::value, + _And< _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>, // use the copy constructor instead, see #92676 + _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>, + _Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>, + _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>, + _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>, + _Not<is_convertible<expected<_Up, _OtherErr>&, _Tp>>, + _Not<is_convertible<expected<_Up, _OtherErr>&&, _Tp>>, + _Not<is_convertible<const expected<_Up, _OtherErr>&, _Tp>>, + _Not<is_convertible<const expected<_Up, _OtherErr>&&, _Tp>>>, + true_type>, + _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>, + _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>, + _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>, + _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>> >; template <class _Func, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit expected( @@ -918,9 +919,9 @@ public: requires is_constructible_v<_Err, _Err&> _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & { using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>; - static_assert(__is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected"); + static_assert(__is_std_expected<_Up>::value, "The result of f(value()) must be a specialization of std::expected"); static_assert(is_same_v<typename _Up::error_type, _Err>, - "The result of f(**this) must have the same error_type as this expected"); + "The result of f(value()) must have the same error_type as this expected"); if (has_value()) { return std::invoke(std::forward<_Func>(__f), this->__val()); } @@ -931,9 +932,9 @@ public: requires is_constructible_v<_Err, const _Err&> _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& { using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&>>; - static_assert(__is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected"); + static_assert(__is_std_expected<_Up>::value, "The result of f(value()) must be a specialization of std::expected"); static_assert(is_same_v<typename _Up::error_type, _Err>, - "The result of f(**this) must have the same error_type as this expected"); + "The result of f(value()) must have the same error_type as this expected"); if (has_value()) { return std::invoke(std::forward<_Func>(__f), this->__val()); } @@ -945,9 +946,9 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && { using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&&>>; static_assert( - __is_std_expected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected"); + __is_std_expected<_Up>::value, "The result of f(std::move(value())) must be a specialization of std::expected"); static_assert(is_same_v<typename _Up::error_type, _Err>, - "The result of f(std::move(**this)) must have the same error_type as this expected"); + "The result of f(std::move(value())) must have the same error_type as this expected"); if (has_value()) { return std::invoke(std::forward<_Func>(__f), std::move(this->__val())); } @@ -959,9 +960,9 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& { using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&&>>; static_assert( - __is_std_expected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected"); + __is_std_expected<_Up>::value, "The result of f(std::move(value())) must be a specialization of std::expected"); static_assert(is_same_v<typename _Up::error_type, _Err>, - "The result of f(std::move(**this)) must have the same error_type as this expected"); + "The result of f(std::move(value())) must have the same error_type as this expected"); if (has_value()) { return std::invoke(std::forward<_Func>(__f), std::move(this->__val())); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h index c40b5d72338..d5daa3fefcd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_entry.h @@ -20,6 +20,7 @@ #include <__filesystem/operations.h> #include <__filesystem/path.h> #include <__filesystem/perms.h> +#include <__fwd/ostream.h> #include <__system_error/errc.h> #include <__system_error/error_code.h> #include <__utility/move.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/filesystem_error.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/filesystem_error.h index 80a11e3b193..f43568c2004 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/filesystem_error.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/filesystem_error.h @@ -69,13 +69,13 @@ private: # ifndef _LIBCPP_HAS_NO_EXCEPTIONS template <class... _Args> -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void __throw_filesystem_error(_Args&&... __args) { throw filesystem_error(std::forward<_Args>(__args)...); } # else template <class... _Args> -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void __throw_filesystem_error(_Args&&...) { _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode"); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h index ff468d51772..f0d39680430 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h @@ -21,6 +21,7 @@ #include <__type_traits/is_pointer.h> #include <__type_traits/remove_const.h> #include <__type_traits/remove_pointer.h> +#include <__utility/move.h> #include <cstddef> #include <string> #include <string_view> @@ -811,7 +812,7 @@ public: _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); } // query - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); } _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); } _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h index 8598f0a1c03..ce9ac0c81e3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h @@ -646,7 +646,7 @@ private: } // namespace __format -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h index 13380e9b91a..737783ed4bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/concepts.h @@ -75,8 +75,8 @@ template <class _Tp> concept __fmt_pair_like = __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2); -# endif //_LIBCPP_STD_VER >= 23 -#endif //_LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/container_adaptor.h b/contrib/libs/cxxsupp/libcxx/include/__format/container_adaptor.h index 9f49ca03bf4..d3be2e18956 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/container_adaptor.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/container_adaptor.h @@ -66,7 +66,7 @@ template <class _CharT, class _Tp, formattable<_CharT> _Container> struct _LIBCPP_TEMPLATE_VIS formatter<stack<_Tp, _Container>, _CharT> : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {}; -#endif //_LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/enable_insertable.h b/contrib/libs/cxxsupp/libcxx/include/__format/enable_insertable.h index 86ef94a325b..29fe566ff06 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/enable_insertable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/enable_insertable.h @@ -28,7 +28,7 @@ inline constexpr bool __enable_insertable = false; } // namespace __format -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/escaped_output_table.h b/contrib/libs/cxxsupp/libcxx/include/__format/escaped_output_table.h index f7be2dc61f2..bdf86cb6f99 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/escaped_output_table.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/escaped_output_table.h @@ -856,7 +856,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[711] = { // clang-format on } // namespace __escaped_output_table -#endif //_LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h b/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h index 48581d8a5dd..7dbc239f5f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/extended_grapheme_cluster_table.h @@ -1656,7 +1656,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[1496] = { } // namespace __extended_grapheme_custer_property_boundary -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h index aa02f81dc40..d1ce0558744 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h @@ -392,7 +392,7 @@ _LIBCPP_DEPRECATED_IN_CXX26 } } -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h index 23a599e9957..68e936aceca 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h @@ -22,6 +22,7 @@ #include <__type_traits/conditional.h> #include <__type_traits/extent.h> #include <__type_traits/remove_const.h> +#include <cstdint> #include <string> #include <string_view> @@ -259,7 +260,7 @@ struct _LIBCPP_TEMPLATE_VIS __format_arg_store { _Storage __storage; }; -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_args.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_args.h index a5fde36a298..e19b4458e41 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_args.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_args.h @@ -28,8 +28,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Context> class _LIBCPP_TEMPLATE_VIS basic_format_args { public: - basic_format_args() noexcept = default; - template <class... _Args> _LIBCPP_HIDE_FROM_ABI basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept : __size_(sizeof...(_Args)) { @@ -73,7 +71,7 @@ private: template <class _Context, class... _Args> basic_format_args(__format_arg_store<_Context, _Args...>) -> basic_format_args<_Context>; -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h index 087d4bf289b..a9be17b8558 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h @@ -131,6 +131,10 @@ private: _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args) : __out_it_(std::move(__out_it)), __args_(__args) {} # endif + +public: + basic_format_context(const basic_format_context&) = delete; + basic_format_context& operator=(const basic_format_context&) = delete; }; // A specialization for __retarget_buffer @@ -208,7 +212,7 @@ private: }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_context); -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_error.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_error.h index ed40e395d6a..1df7dbff2b7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_error.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_error.h @@ -35,7 +35,7 @@ public: }; _LIBCPP_DIAGNOSTIC_POP -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) { +[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw format_error(__s); # else @@ -43,7 +43,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const ch # endif } -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h index d14b49aff14..1518ab5768d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_functions.h @@ -360,7 +360,7 @@ _LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wst return __fmt; } # endif -# endif //_LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 template <class _CharT, class... _Args> struct _LIBCPP_TEMPLATE_VIS basic_format_string { @@ -671,7 +671,7 @@ formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) # endif // _LIBCPP_HAS_NO_LOCALIZATION -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_parse_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_parse_context.h index aefcd5497f3..54c23014e7d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_parse_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_parse_context.h @@ -98,7 +98,7 @@ using format_parse_context = basic_format_parse_context<char>; using wformat_parse_context = basic_format_parse_context<wchar_t>; # endif -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_string.h index bdf3cff7f49..a499afee887 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_string.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_string.h @@ -153,7 +153,7 @@ __parse_arg_id(_Iterator __begin, _Iterator __end, auto& __parse_ctx) { } // namespace __format -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_to_n_result.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_to_n_result.h index 6f30546dec0..344299e32f0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_to_n_result.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_to_n_result.h @@ -28,7 +28,7 @@ struct _LIBCPP_TEMPLATE_VIS format_to_n_result { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(format_to_n_result); -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h index e2f418f936e..39c2670dd84 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h @@ -40,6 +40,9 @@ struct _LIBCPP_TEMPLATE_VIS formatter { # if _LIBCPP_STD_VER >= 23 template <class _Tp> +constexpr bool enable_nonlocking_formatter_optimization = false; + +template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) { if constexpr (requires { __formatter.set_debug_format(); }) __formatter.set_debug_format(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h index 17dc69541e8..a43eba53c93 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h @@ -69,7 +69,11 @@ public: __format_spec::__parser<_CharT> __parser_; }; -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<bool> = true; +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h index d33e84368a7..a96acba08d5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_char.h @@ -83,10 +83,18 @@ struct _LIBCPP_TEMPLATE_VIS formatter<char, wchar_t> : public __formatter_char<w template <> struct _LIBCPP_TEMPLATE_VIS formatter<wchar_t, wchar_t> : public __formatter_char<wchar_t> {}; - # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<char> = true; +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<wchar_t> = true; +# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_STD_VER >= 23 + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h index fa42ba203b0..fc95dd3f22b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h @@ -774,7 +774,15 @@ struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT> : public __formatter_float template <__fmt_char_type _CharT> struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT> : public __formatter_floating_point<_CharT> {}; -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<float> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<double> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<long double> = true; +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integer.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integer.h index 41400f00478..b7f46014c57 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integer.h @@ -88,7 +88,38 @@ template <__fmt_char_type _CharT> struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {}; # endif -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<signed char> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<short> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<int> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<long> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<long long> = true; +# ifndef _LIBCPP_HAS_NO_INT128 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<__int128_t> = true; +# endif + +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<unsigned char> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<unsigned short> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<unsigned> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<unsigned long> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<unsigned long long> = true; +# ifndef _LIBCPP_HAS_NO_INT128 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<__uint128_t> = true; +# endif +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h index eca966f8886..beed3ab8d93 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_integral.h @@ -436,7 +436,7 @@ __format_bool(bool __value, _FormatContext& __ctx, __format_spec::__parsed_speci } // namespace __formatter -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h index 1498f64c4ae..34c4c87313a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_output.h @@ -326,7 +326,7 @@ _LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __pre } // namespace __formatter -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h index 6941343efd9..6e0fa9a1b4f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_pointer.h @@ -65,7 +65,15 @@ struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointe template <__fmt_char_type _CharT> struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT> : public __formatter_pointer<_CharT> {}; -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<nullptr_t> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<void*> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<const void*> = true; +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h index 347439fc8df..b29e97847f0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h @@ -143,7 +143,32 @@ struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT } }; -#endif //_LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 23 +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<char*> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<const char*> = true; +template <size_t _Size> +inline constexpr bool enable_nonlocking_formatter_optimization<char[_Size]> = true; +template <class _Traits, class _Allocator> +inline constexpr bool enable_nonlocking_formatter_optimization<basic_string<char, _Traits, _Allocator>> = true; +template <class _Traits> +inline constexpr bool enable_nonlocking_formatter_optimization<basic_string_view<char, _Traits>> = true; + +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<wchar_t*> = true; +template <> +inline constexpr bool enable_nonlocking_formatter_optimization<const wchar_t*> = true; +template <size_t _Size> +inline constexpr bool enable_nonlocking_formatter_optimization<wchar_t[_Size]> = true; +template <class _Traits, class _Allocator> +inline constexpr bool enable_nonlocking_formatter_optimization<basic_string<wchar_t, _Traits, _Allocator>> = true; +template <class _Traits> +inline constexpr bool enable_nonlocking_formatter_optimization<basic_string_view<wchar_t, _Traits>> = true; +# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_tuple.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_tuple.h index 030097a8797..bb841ef1144 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_tuple.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_tuple.h @@ -143,7 +143,7 @@ template <__fmt_char_type _CharT, formattable<_CharT>... _Args> struct _LIBCPP_TEMPLATE_VIS formatter<tuple<_Args...>, _CharT> : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {}; -#endif //_LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/indic_conjunct_break_table.h b/contrib/libs/cxxsupp/libcxx/include/__format/indic_conjunct_break_table.h index 44521d27498..39dd45da771 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/indic_conjunct_break_table.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/indic_conjunct_break_table.h @@ -343,7 +343,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[201] = { } // namespace __indic_conjunct_break -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h index 150bdde89f3..6bdf8e319ba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/parser_std_format_spec.h @@ -52,13 +52,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace __format_spec { -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void +[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_option_format_error(const char* __id, const char* __option) { std::__throw_format_error( (string("The format specifier for ") + __id + " does not allow the " + __option + " option").c_str()); } -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) { +[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) { std::__throw_format_error( (string("The type option contains an invalid value for ") + __id + " formatting argument").c_str()); } @@ -1163,7 +1163,7 @@ __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __col } // namespace __format_spec -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/range_default_formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/range_default_formatter.h index b35223ae933..fb21b0f8beb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/range_default_formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/range_default_formatter.h @@ -207,7 +207,7 @@ template <ranges::input_range _Rp, class _CharT> requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>) struct _LIBCPP_TEMPLATE_VIS formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; -#endif //_LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h index 69156307434..def55c86ce5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/range_formatter.h @@ -257,7 +257,7 @@ private: basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]"); }; -#endif //_LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h index de7d0fea1df..ce6d55ae346 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/unicode.h @@ -595,7 +595,7 @@ private: } // namespace __unicode -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/width_estimation_table.h b/contrib/libs/cxxsupp/libcxx/include/__format/width_estimation_table.h index 11f61dea18d..23a08746b91 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/width_estimation_table.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/width_estimation_table.h @@ -263,7 +263,7 @@ inline constexpr uint32_t __table_upper_bound = 0x0003fffd; } // namespace __width_estimation_table -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h b/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h index 052ea98c3c3..9c288a84d0c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/write_escaped.h @@ -16,6 +16,7 @@ #include <__charconv/to_chars_result.h> #include <__chrono/statically_widen.h> #include <__format/escaped_output_table.h> +#include <__format/extended_grapheme_cluster_table.h> #include <__format/formatter_output.h> #include <__format/parser_std_format_spec.h> #include <__format/unicode.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h index 3996460c52c..c1af67f2ad1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h @@ -11,10 +11,10 @@ #define _LIBCPP___FUNCTIONAL_BIND_H #include <__config> -#include <__functional/invoke.h> #include <__functional/weak_result_type.h> #include <__fwd/functional.h> #include <__type_traits/decay.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_reference_wrapper.h> #include <__type_traits/is_void.h> #include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index c7b98035e34..0d95c9a6ef2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -78,7 +78,7 @@ public: }; _LIBCPP_DIAGNOSTIC_POP -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_function_call(); # else @@ -143,45 +143,46 @@ class __default_alloc_func; template <class _Fp, class _Ap, class _Rp, class... _ArgTypes> class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> { - __compressed_pair<_Fp, _Ap> __f_; + _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Ap, __alloc_); public: typedef _LIBCPP_NODEBUG _Fp _Target; typedef _LIBCPP_NODEBUG _Ap _Alloc; - _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_.first(); } + _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __func_; } // WIN32 APIs may define __allocator, so use __get_allocator instead. - _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __f_.second(); } + _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __alloc_; } - _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f) - : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {} + _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f) : __func_(std::move(__f)), __alloc_() {} - _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a) - : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {} + _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a) : __func_(__f), __alloc_(__a) {} _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, _Alloc&& __a) - : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(std::move(__a))) {} + : __func_(__f), __alloc_(std::move(__a)) {} _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f, _Alloc&& __a) - : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple(std::move(__a))) {} + : __func_(std::move(__f)), __alloc_(std::move(__a)) {} _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) { typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...); + return _Invoker::__call(__func_, std::forward<_ArgTypes>(__arg)...); } _LIBCPP_HIDE_FROM_ABI __alloc_func* __clone() const { typedef allocator_traits<_Alloc> __alloc_traits; typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA; - _AA __a(__f_.second()); + _AA __a(__alloc_); typedef __allocator_destructor<_AA> _Dp; unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __alloc_func(__func_, _Alloc(__a)); return __hold.release(); } - _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); } + _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { + __func_.~_Fp(); + __alloc_.~_Alloc(); + } _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) { typedef allocator_traits<_Alloc> __alloc_traits; diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h index a9e450edd39..59dce7ac9cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h @@ -13,6 +13,7 @@ #include <__functional/unary_function.h> #include <__fwd/functional.h> #include <__type_traits/conjunction.h> +#include <__type_traits/enable_if.h> #include <__type_traits/invoke.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_enum.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h index 8468de3dae2..1b1c6cf73c3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h @@ -26,7 +26,7 @@ struct __is_identity : false_type {}; struct __identity { template <class _Tp> - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT { return std::forward<_Tp>(__t); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h index ef4bf25f077..ab201e94206 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h @@ -12,6 +12,7 @@ #include <__config> #include <__type_traits/invoke.h> +#include <__type_traits/is_void.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h index ee07a71774f..58dbdf871d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h @@ -12,8 +12,8 @@ #include <__config> #include <__functional/binary_function.h> -#include <__functional/invoke.h> #include <__functional/weak_result_type.h> +#include <__type_traits/invoke.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h b/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h index 0a6320f19de..6022bd679ed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h @@ -14,6 +14,7 @@ #include <__functional/binary_function.h> #include <__functional/unary_function.h> #include <__type_traits/desugars_to.h> +#include <__type_traits/is_integral.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -362,7 +363,7 @@ struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> { _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less); template <class _Tp> -inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true; +inline const bool __desugars_to_v<__totally_ordered_less_tag, less<_Tp>, _Tp, _Tp> = is_integral<_Tp>::value; #if _LIBCPP_STD_VER >= 14 template <> @@ -377,7 +378,7 @@ struct _LIBCPP_TEMPLATE_VIS less<void> { }; template <class _Tp> -inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Tp> = true; +inline const bool __desugars_to_v<__totally_ordered_less_tag, less<>, _Tp, _Tp> = is_integral<_Tp>::value; #endif #if _LIBCPP_STD_VER >= 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h b/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h index 74177c789b4..8fd68db3d6e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h @@ -11,6 +11,7 @@ #define _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/enable_if.h> #include <__type_traits/invoke.h> #include <__type_traits/is_constructible.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h b/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h index 27f06eadd0e..f023d765a6c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h @@ -100,7 +100,7 @@ template <class _Tp, class _Up> inline const bool __desugars_to_v<__equal_tag, ranges::equal_to, _Tp, _Up> = true; template <class _Tp, class _Up> -inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true; +inline const bool __desugars_to_v<__totally_ordered_less_tag, ranges::less, _Tp, _Up> = true; #endif // _LIBCPP_STD_VER >= 20 diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h index 3570e2673c8..a4a66a50cf8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h @@ -13,10 +13,10 @@ #include <__compare/synth_three_way.h> #include <__concepts/boolean_testable.h> #include <__config> -#include <__functional/invoke.h> #include <__functional/weak_result_type.h> #include <__memory/addressof.h> #include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_const.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/void_t.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h b/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h index ad7a8395186..793775a2903 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h @@ -12,9 +12,9 @@ #include <__config> #include <__functional/binary_function.h> -#include <__functional/invoke.h> #include <__functional/unary_function.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_same.h> #include <__utility/declval.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h index b429d0c5a95..794779ae46a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/array.h @@ -10,7 +10,8 @@ #define _LIBCPP___FWD_ARRAY_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> +#include <__type_traits/integral_constant.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -35,11 +36,11 @@ template <size_t _Ip, class _Tp, size_t _Size> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; #endif -template <class> -struct __is_std_array : false_type {}; +template <class _Tp> +inline const bool __is_std_array_v = false; template <class _Tp, size_t _Size> -struct __is_std_array<array<_Tp, _Size> > : true_type {}; +inline const bool __is_std_array_v<array<_Tp, _Size> > = true; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/byte.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/byte.h new file mode 100644 index 00000000000..0301833d93c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/byte.h @@ -0,0 +1,26 @@ +//===---------------------------------------------------------------------===// +// +// 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_BYTE_H +#define _LIBCPP___FWD_BYTE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER >= 17 +namespace std { // purposefully not versioned + +enum class byte : unsigned char; + +} // namespace std +#endif // _LIBCPP_STD_VER >= 17 + +#endif // _LIBCPP___FWD_BYTE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h index 22c78c5cc3c..092d2e10b12 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/complex.h @@ -10,7 +10,7 @@ #define _LIBCPP___FWD_COMPLEX_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/format.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/format.h index b30c220f8a0..815e3e1922c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/format.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/format.h @@ -31,7 +31,7 @@ class _LIBCPP_TEMPLATE_VIS basic_format_context; template <class _Tp, class _CharT = char> struct _LIBCPP_TEMPLATE_VIS formatter; -#endif //_LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h new file mode 100644 index 00000000000..6121ed0efd2 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/get.h @@ -0,0 +1,24 @@ +//===---------------------------------------------------------------------===// +// +// 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_GET_H +#define _LIBCPP___FWD_GET_H + +#include <__config> +#include <__fwd/array.h> +#include <__fwd/complex.h> +#include <__fwd/pair.h> +#include <__fwd/subrange.h> +#include <__fwd/tuple.h> +#include <__fwd/variant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#endif // _LIBCPP___FWD_GET_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h index af32628fe1e..b8ba2b7e923 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/pair.h @@ -10,8 +10,8 @@ #define _LIBCPP___FWD_PAIR_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/tuple.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h index 8dafa742c19..5d473ee51c6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/span.h @@ -11,7 +11,7 @@ #define _LIBCPP___FWD_SPAN_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h index 60a41da23dd..5b3a07e5534 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/subrange.h @@ -11,8 +11,8 @@ #include <__concepts/copyable.h> #include <__config> +#include <__cstddef/size_t.h> #include <__iterator/concepts.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h index 902770c2955..2ed32bc0df4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/tuple.h @@ -10,7 +10,7 @@ #define _LIBCPP___FWD_TUPLE_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__fwd/variant.h b/contrib/libs/cxxsupp/libcxx/include/__fwd/variant.h new file mode 100644 index 00000000000..71c792f46a9 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__fwd/variant.h @@ -0,0 +1,77 @@ +//===---------------------------------------------------------------------===// +// +// 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_VARIANT_H +#define _LIBCPP___FWD_VARIANT_H + +#include <__config> +#include <__cstddef/size_t.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +template <class... _Types> +class _LIBCPP_TEMPLATE_VIS variant; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS variant_size; + +template <class _Tp> +inline constexpr size_t variant_size_v = variant_size<_Tp>::value; + +template <size_t _Ip, class _Tp> +struct _LIBCPP_TEMPLATE_VIS variant_alternative; + +template <size_t _Ip, class _Tp> +using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type; + +inline constexpr size_t variant_npos = static_cast<size_t>(-1); + +template <size_t _Ip, class... _Types> +_LIBCPP_HIDE_FROM_ABI +_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>& +get(variant<_Types...>&); + +template <size_t _Ip, class... _Types> +_LIBCPP_HIDE_FROM_ABI +_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&& +get(variant<_Types...>&&); + +template <size_t _Ip, class... _Types> +_LIBCPP_HIDE_FROM_ABI +_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>& +get(const variant<_Types...>&); + +template <size_t _Ip, class... _Types> +_LIBCPP_HIDE_FROM_ABI +_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& +get(const variant<_Types...>&&); + +template <class _Tp, class... _Types> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp& get(variant<_Types...>&); + +template <class _Tp, class... _Types> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp&& get(variant<_Types...>&&); + +template <class _Tp, class... _Types> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp& get(const variant<_Types...>&); + +template <class _Tp, class... _Types> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&& +get(const variant<_Types...>&&); + +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___FWD_VARIANT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table index 02575852857..821d4edd8d8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__hash_table +++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table @@ -16,8 +16,8 @@ #include <__bit/countl.h> #include <__config> #include <__functional/hash.h> -#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__math/rounding_functions.h> #include <__memory/addressof.h> #include <__memory/allocator_traits.h> #include <__memory/compressed_pair.h> @@ -27,6 +27,8 @@ #include <__memory/unique_ptr.h> #include <__type_traits/can_extract_key.h> #include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_const.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_nothrow_assignable.h> @@ -40,9 +42,8 @@ #include <__utility/move.h> #include <__utility/pair.h> #include <__utility/swap.h> -#include <cmath> #include <cstring> -#include <initializer_list> +#include <limits> #include <new> // __launder #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -77,11 +78,18 @@ struct __hash_node_base { typedef __hash_node_base __first_node; typedef __rebind_pointer_t<_NodePtr, __first_node> __node_base_pointer; typedef _NodePtr __node_pointer; - -#if defined(_LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB) typedef __node_base_pointer __next_pointer; -#else - typedef __conditional_t<is_pointer<__node_pointer>::value, __node_base_pointer, __node_pointer> __next_pointer; + +// TODO(LLVM 22): Remove this check +#ifndef _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB + static_assert(sizeof(__node_base_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) == + _LIBCPP_ALIGNOF(__node_pointer), + "It looks like you are using std::__hash_table (an implementation detail for the unordered containers) " + "with a fancy pointer type that thas a different representation depending on whether it points to a " + "__hash_table base pointer or a __hash_table node pointer (both of which are implementation details of " + "the standard library). This means that your ABI is being broken between LLVM 19 and LLVM 20. If you " + "don't care about your ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to " + "silence this diagnostic."); #endif __next_pointer __next_; @@ -554,29 +562,29 @@ class __bucket_list_deallocator { typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; - __compressed_pair<size_type, allocator_type> __data_; + _LIBCPP_COMPRESSED_PAIR(size_type, __size_, allocator_type, __alloc_); public: typedef typename __alloc_traits::pointer pointer; _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __data_(0, __default_init_tag()) {} + : __size_(0) {} _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(const allocator_type& __a, size_type __size) _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) - : __data_(__size, __a) {} + : __size_(__size), __alloc_(__a) {} _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) - : __data_(std::move(__x.__data_)) { + : __size_(std::move(__x.__size_)), __alloc_(std::move(__x.__alloc_)) { __x.size() = 0; } - _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __data_.first(); } - _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __data_.first(); } + _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; } + _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } - _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __data_.second(); } - _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __data_.second(); } + _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __alloc_; } + _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __alloc_; } _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc(), __p, size()); } }; @@ -716,27 +724,27 @@ private: // --- Member data begin --- __bucket_list __bucket_list_; - __compressed_pair<__first_node, __node_allocator> __p1_; - __compressed_pair<size_type, hasher> __p2_; - __compressed_pair<float, key_equal> __p3_; + _LIBCPP_COMPRESSED_PAIR(__first_node, __first_node_, __node_allocator, __node_alloc_); + _LIBCPP_COMPRESSED_PAIR(size_type, __size_, hasher, __hasher_); + _LIBCPP_COMPRESSED_PAIR(float, __max_load_factor_, key_equal, __key_eq_); // --- Member data end --- - _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __p2_.first(); } + _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; } public: - _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __p2_.first(); } + _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } - _LIBCPP_HIDE_FROM_ABI hasher& hash_function() _NOEXCEPT { return __p2_.second(); } - _LIBCPP_HIDE_FROM_ABI const hasher& hash_function() const _NOEXCEPT { return __p2_.second(); } + _LIBCPP_HIDE_FROM_ABI hasher& hash_function() _NOEXCEPT { return __hasher_; } + _LIBCPP_HIDE_FROM_ABI const hasher& hash_function() const _NOEXCEPT { return __hasher_; } - _LIBCPP_HIDE_FROM_ABI float& max_load_factor() _NOEXCEPT { return __p3_.first(); } - _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __p3_.first(); } + _LIBCPP_HIDE_FROM_ABI float& max_load_factor() _NOEXCEPT { return __max_load_factor_; } + _LIBCPP_HIDE_FROM_ABI float max_load_factor() const _NOEXCEPT { return __max_load_factor_; } - _LIBCPP_HIDE_FROM_ABI key_equal& key_eq() _NOEXCEPT { return __p3_.second(); } - _LIBCPP_HIDE_FROM_ABI const key_equal& key_eq() const _NOEXCEPT { return __p3_.second(); } + _LIBCPP_HIDE_FROM_ABI key_equal& key_eq() _NOEXCEPT { return __key_eq_; } + _LIBCPP_HIDE_FROM_ABI const key_equal& key_eq() const _NOEXCEPT { return __key_eq_; } - _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __p1_.second(); } - _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __p1_.second(); } + _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; } + _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; } public: typedef __hash_iterator<__node_pointer> iterator; @@ -875,10 +883,10 @@ public: _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); } _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); } _LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n) { - __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor()))); + __rehash_unique(static_cast<size_type>(__math::ceil(__n / max_load_factor()))); } _LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n) { - __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor()))); + __rehash_multi(static_cast<size_type>(__math::ceil(__n / max_load_factor()))); } _LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __bucket_list_.get_deleter().size(); } @@ -1022,26 +1030,34 @@ inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() _NOEXCEPT_( is_nothrow_default_constructible<__bucket_list>::value&& is_nothrow_default_constructible<__first_node>::value&& is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_default_constructible<hasher>::value&& is_nothrow_default_constructible<key_equal>::value) - : __p2_(0, __default_init_tag()), __p3_(1.0f, __default_init_tag()) {} + : __size_(0), __max_load_factor_(1.0f) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql) - : __bucket_list_(nullptr, __bucket_list_deleter()), __p1_(), __p2_(0, __hf), __p3_(1.0f, __eql) {} + : __bucket_list_(nullptr, __bucket_list_deleter()), + __first_node_(), + __node_alloc_(), + __size_(0), + __hasher_(__hf), + __max_load_factor_(1.0f), + __key_eq_(__eql) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table( const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__default_init_tag(), __node_allocator(__a)), - __p2_(0, __hf), - __p3_(1.0f, __eql) {} + __node_alloc_(__node_allocator(__a)), + __size_(0), + __hasher_(__hf), + __max_load_factor_(1.0f), + __key_eq_(__eql) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__default_init_tag(), __node_allocator(__a)), - __p2_(0, __default_init_tag()), - __p3_(1.0f, __default_init_tag()) {} + __node_alloc_(__node_allocator(__a)), + __size_(0), + __max_load_factor_(1.0f) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) @@ -1049,17 +1065,20 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) __bucket_list_deleter(allocator_traits<__pointer_allocator>::select_on_container_copy_construction( __u.__bucket_list_.get_deleter().__alloc()), 0)), - __p1_(__default_init_tag(), - allocator_traits<__node_allocator>::select_on_container_copy_construction(__u.__node_alloc())), - __p2_(0, __u.hash_function()), - __p3_(__u.__p3_) {} + __node_alloc_(allocator_traits<__node_allocator>::select_on_container_copy_construction(__u.__node_alloc())), + __size_(0), + __hasher_(__u.hash_function()), + __max_load_factor_(__u.__max_load_factor_), + __key_eq_(__u.__key_eq_) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__default_init_tag(), __node_allocator(__a)), - __p2_(0, __u.hash_function()), - __p3_(__u.__p3_) {} + __node_alloc_(__node_allocator(__a)), + __size_(0), + __hasher_(__u.hash_function()), + __max_load_factor_(__u.__max_load_factor_), + __key_eq_(__u.__key_eq_) {} template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) _NOEXCEPT_( @@ -1067,12 +1086,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) _NOEX is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<hasher>::value&& is_nothrow_move_constructible<key_equal>::value) : __bucket_list_(std::move(__u.__bucket_list_)), - __p1_(std::move(__u.__p1_)), - __p2_(std::move(__u.__p2_)), - __p3_(std::move(__u.__p3_)) { + __first_node_(std::move(__u.__first_node_)), + __node_alloc_(std::move(__u.__node_alloc_)), + __size_(std::move(__u.__size_)), + __hasher_(std::move(__u.__hasher_)), + __max_load_factor_(__u.__max_load_factor_), + __key_eq_(std::move(__u.__key_eq_)) { if (size() > 0) { - __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); - __u.__p1_.first().__next_ = nullptr; + __bucket_list_[std::__constrain_hash(__first_node_.__next_->__hash(), bucket_count())] = __first_node_.__ptr(); + __u.__first_node_.__next_ = nullptr; __u.size() = 0; } } @@ -1080,17 +1102,19 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) _NOEX template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__default_init_tag(), __node_allocator(__a)), - __p2_(0, std::move(__u.hash_function())), - __p3_(std::move(__u.__p3_)) { + __node_alloc_(__node_allocator(__a)), + __size_(0), + __hasher_(std::move(__u.__hasher_)), + __max_load_factor_(__u.__max_load_factor_), + __key_eq_(std::move(__u.__key_eq_)) { if (__a == allocator_type(__u.__node_alloc())) { __bucket_list_.reset(__u.__bucket_list_.release()); __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size(); __u.__bucket_list_.get_deleter().size() = 0; if (__u.size() > 0) { - __p1_.first().__next_ = __u.__p1_.first().__next_; - __u.__p1_.first().__next_ = nullptr; - __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); + __first_node_.__next_ = __u.__first_node_.__next_; + __u.__first_node_.__next_ = nullptr; + __bucket_list_[std::__constrain_hash(__first_node_.__next_->__hash(), bucket_count())] = __first_node_.__ptr(); size() = __u.size(); __u.size() = 0; } @@ -1104,7 +1128,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() { static_assert(is_copy_constructible<hasher>::value, "Hasher must be copy-constructible."); #endif - __deallocate_node(__p1_.first().__next_); + __deallocate_node(__first_node_.__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1150,8 +1174,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT { for (size_type __i = 0; __i < __bc; ++__i) __bucket_list_[__i] = nullptr; size() = 0; - __next_pointer __cache = __p1_.first().__next_; - __p1_.first().__next_ = nullptr; + __next_pointer __cache = __first_node_.__next_; + __first_node_.__next_ = nullptr; return __cache; } @@ -1168,10 +1192,10 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u, hash_function() = std::move(__u.hash_function()); max_load_factor() = __u.max_load_factor(); key_eq() = std::move(__u.key_eq()); - __p1_.first().__next_ = __u.__p1_.first().__next_; + __first_node_.__next_ = __u.__first_node_.__next_; if (size() > 0) { - __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); - __u.__p1_.first().__next_ = nullptr; + __bucket_list_[std::__constrain_hash(__first_node_.__next_->__hash(), bucket_count())] = __first_node_.__ptr(); + __u.__first_node_.__next_ = nullptr; __u.size() = 0; } } @@ -1288,7 +1312,7 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __f template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT { - return iterator(__p1_.first().__next_); + return iterator(__first_node_.__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1300,7 +1324,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT { template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT { - return const_iterator(__p1_.first().__next_); + return const_iterator(__first_node_.__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1312,8 +1336,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT { template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT { if (size() > 0) { - __deallocate_node(__p1_.first().__next_); - __p1_.first().__next_ = nullptr; + __deallocate_node(__first_node_.__next_); + __first_node_.__next_ = nullptr; size_type __bc = bucket_count(); for (size_type __i = 0; __i < __bc; ++__i) __bucket_list_[__i] = nullptr; @@ -1348,7 +1372,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(size_t __ } if (size() + 1 > __bc * max_load_factor() || __bc == 0) { __rehash_unique(std::max<size_type>( - 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor())))); + 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor())))); } return nullptr; } @@ -1365,7 +1389,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform(__node_po // insert_after __bucket_list_[__chash], or __first_node if bucket is null __next_pointer __pn = __bucket_list_[__chash]; if (__pn == nullptr) { - __pn = __p1_.first().__ptr(); + __pn = __first_node_.__ptr(); __nd->__next_ = __pn->__next_; __pn->__next_ = __nd->__ptr(); // fix up __bucket_list_ @@ -1408,7 +1432,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(size_t __c size_type __bc = bucket_count(); if (size() + 1 > __bc * max_load_factor() || __bc == 0) { __rehash_multi(std::max<size_type>( - 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor())))); + 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } size_t __chash = std::__constrain_hash(__cp_hash, __bc); @@ -1445,7 +1469,7 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( size_type __bc = bucket_count(); size_t __chash = std::__constrain_hash(__cp->__hash_, __bc); if (__pn == nullptr) { - __pn = __p1_.first().__ptr(); + __pn = __first_node_.__ptr(); __cp->__next_ = __pn->__next_; __pn->__next_ = __cp->__ptr(); // fix up __bucket_list_ @@ -1483,7 +1507,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p size_type __bc = bucket_count(); if (size() + 1 > __bc * max_load_factor() || __bc == 0) { __rehash_multi(std::max<size_type>( - 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor())))); + 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } size_t __chash = std::__constrain_hash(__cp->__hash_, __bc); @@ -1523,14 +1547,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...); if (size() + 1 > __bc * max_load_factor() || __bc == 0) { __rehash_unique(std::max<size_type>( - 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor())))); + 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); __chash = std::__constrain_hash(__hash, __bc); } // insert_after __bucket_list_[__chash], or __first_node if bucket is null __next_pointer __pn = __bucket_list_[__chash]; if (__pn == nullptr) { - __pn = __p1_.first().__ptr(); + __pn = __first_node_.__ptr(); __h->__next_ = __pn->__next_; __pn->__next_ = __h.get()->__ptr(); // fix up __bucket_list_ @@ -1692,8 +1716,8 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_D else if (__n < __bc) { __n = std::max<size_type>( __n, - std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor()))) - : std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor())))); + std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(__math::ceil(float(size()) / max_load_factor()))) + : std::__next_prime(size_t(__math::ceil(float(size()) / max_load_factor())))); if (__n < __bc) __do_rehash<_UniqueKeys>(__n); } @@ -1708,7 +1732,7 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc) { if (__nbc > 0) { for (size_type __i = 0; __i < __nbc; ++__i) __bucket_list_[__i] = nullptr; - __next_pointer __pp = __p1_.first().__ptr(); + __next_pointer __pp = __first_node_.__ptr(); __next_pointer __cp = __pp->__next_; if (__cp != nullptr) { size_type __chash = std::__constrain_hash(__cp->__hash(), __nbc); @@ -1885,7 +1909,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT { // Fix up __bucket_list_ // if __pn is not in same bucket (before begin is not in same bucket) && // if __cn->__next_ is not in same bucket (nullptr is not in same bucket) - if (__pn == __p1_.first().__ptr() || std::__constrain_hash(__pn->__hash(), __bc) != __chash) { + if (__pn == __first_node_.__ptr() || std::__constrain_hash(__pn->__hash(), __bc) != __chash) { if (__cn->__next_ == nullptr || std::__constrain_hash(__cn->__next_->__hash(), __bc) != __chash) __bucket_list_[__chash] = nullptr; } @@ -2004,14 +2028,17 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) std::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size()); std::__swap_allocator(__bucket_list_.get_deleter().__alloc(), __u.__bucket_list_.get_deleter().__alloc()); std::__swap_allocator(__node_alloc(), __u.__node_alloc()); - std::swap(__p1_.first().__next_, __u.__p1_.first().__next_); - __p2_.swap(__u.__p2_); - __p3_.swap(__u.__p3_); + std::swap(__first_node_.__next_, __u.__first_node_.__next_); + using std::swap; + swap(__size_, __u.__size_); + swap(__hasher_, __u.__hasher_); + swap(__max_load_factor_, __u.__max_load_factor_); + swap(__key_eq_, __u.__key_eq_); if (size() > 0) - __bucket_list_[std::__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); + __bucket_list_[std::__constrain_hash(__first_node_.__next_->__hash(), bucket_count())] = __first_node_.__ptr(); if (__u.size() > 0) - __u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = - __u.__p1_.first().__ptr(); + __u.__bucket_list_[std::__constrain_hash(__u.__first_node_.__next_->__hash(), __u.bucket_count())] = + __u.__first_node_.__ptr(); } 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 4c51bdefd85..62e89c54788 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/advance.h @@ -76,9 +76,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void advance(_InputIter& __i // [range.iter.op.advance] namespace ranges { -namespace __advance { - -struct __fn { +struct __advance { private: template <class _Ip> _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) { @@ -189,10 +187,8 @@ public: } }; -} // namespace __advance - inline namespace __cpo { -inline constexpr auto advance = __advance::__fn{}; +inline constexpr auto advance = __advance{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h index b5dcfe515c3..2a5322b5d27 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/bounded_iter.h @@ -11,6 +11,8 @@ #define _LIBCPP___ITERATOR_BOUNDED_ITER_H #include <__assert> +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> @@ -201,10 +203,13 @@ public: operator==(___bounded_iter const& __x, ___bounded_iter const& __y) _NOEXCEPT { return __x.__current_ == __y.__current_; } + +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool operator!=(___bounded_iter const& __x, ___bounded_iter const& __y) _NOEXCEPT { return __x.__current_ != __y.__current_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool operator<(___bounded_iter const& __x, ___bounded_iter const& __y) _NOEXCEPT { return __x.__current_ < __y.__current_; @@ -222,9 +227,28 @@ public: return __x.__current_ >= __y.__current_; } +#else + _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering + operator<=>(___bounded_iter const& __x, ___bounded_iter const& __y) noexcept { + if constexpr (three_way_comparable<_Iterator, strong_ordering>) { + return __x.__current_ <=> __y.__current_; + } else { + if (__x.__current_ < __y.__current_) + return strong_ordering::less; + + if (__x.__current_ == __y.__current_) + return strong_ordering::equal; + + return strong_ordering::greater; + } + } +#endif // _LIBCPP_STD_VER >= 20 + private: template <class> friend struct pointer_traits; + template <class, class> + friend struct ___bounded_iter; _Iterator __current_; // current iterator _Iterator __begin_, __end_; // valid range represented as [begin, end] }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h index 199de2cc733..31fc8267e5a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/common_iterator.h @@ -26,6 +26,7 @@ #include <__iterator/iterator_traits.h> #include <__iterator/readable_traits.h> #include <__memory/addressof.h> +#include <__type_traits/conditional.h> #include <__type_traits/is_pointer.h> #include <__utility/declval.h> #include <variant> @@ -235,7 +236,7 @@ public: return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_); } - _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> + _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>()))) requires input_iterator<_Iter> { diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h index afb7b821a99..1c227933a48 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h @@ -26,7 +26,6 @@ #include <__concepts/semiregular.h> #include <__concepts/totally_ordered.h> #include <__config> -#include <__functional/invoke.h> #include <__iterator/incrementable_traits.h> #include <__iterator/iter_move.h> #include <__iterator/iterator_traits.h> @@ -34,7 +33,10 @@ #include <__memory/pointer_traits.h> #include <__type_traits/add_pointer.h> #include <__type_traits/common_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_pointer.h> +#include <__type_traits/is_primary_template.h> #include <__type_traits/is_reference.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_cvref.h> @@ -64,8 +66,33 @@ concept __indirectly_readable_impl = template <class _In> concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>; +template <class _Tp> +using __projected_iterator_t = typename _Tp::__projected_iterator; + +template <class _Tp> +using __projected_projection_t = typename _Tp::__projected_projection; + +template <class _Tp> +concept __specialization_of_projected = requires { + typename __projected_iterator_t<_Tp>; + typename __projected_projection_t<_Tp>; +} && __is_primary_template<_Tp>::value; + +template <class _Tp> +struct __indirect_value_t_impl { + using type = iter_value_t<_Tp>&; +}; +template <__specialization_of_projected _Tp> +struct __indirect_value_t_impl<_Tp> { + using type = invoke_result_t<__projected_projection_t<_Tp>&, + typename __indirect_value_t_impl<__projected_iterator_t<_Tp>>::type>; +}; + +template <indirectly_readable _Tp> +using __indirect_value_t = typename __indirect_value_t_impl<_Tp>::type; + template <indirectly_readable _Tp> -using iter_common_reference_t = common_reference_t<iter_reference_t<_Tp>, iter_value_t<_Tp>&>; +using iter_common_reference_t = common_reference_t<iter_reference_t<_Tp>, __indirect_value_t<_Tp>>; // [iterator.concept.writable] template <class _Out, class _Tp> @@ -176,47 +203,46 @@ concept __has_arrow = input_iterator<_Ip> && (is_pointer_v<_Ip> || requires(_Ip // [indirectcallable.indirectinvocable] template <class _Fp, class _It> concept indirectly_unary_invocable = - indirectly_readable<_It> && copy_constructible<_Fp> && invocable<_Fp&, iter_value_t<_It>&> && - invocable<_Fp&, iter_reference_t<_It>> && invocable<_Fp&, iter_common_reference_t<_It>> && - common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>; + indirectly_readable<_It> && copy_constructible<_Fp> && invocable<_Fp&, __indirect_value_t<_It>> && + invocable<_Fp&, iter_reference_t<_It>> && + common_reference_with< invoke_result_t<_Fp&, __indirect_value_t<_It>>, + invoke_result_t<_Fp&, iter_reference_t<_It>>>; template <class _Fp, class _It> concept indirectly_regular_unary_invocable = - indirectly_readable<_It> && copy_constructible<_Fp> && regular_invocable<_Fp&, iter_value_t<_It>&> && - regular_invocable<_Fp&, iter_reference_t<_It>> && regular_invocable<_Fp&, iter_common_reference_t<_It>> && - common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>; + indirectly_readable<_It> && copy_constructible<_Fp> && regular_invocable<_Fp&, __indirect_value_t<_It>> && + regular_invocable<_Fp&, iter_reference_t<_It>> && + common_reference_with< invoke_result_t<_Fp&, __indirect_value_t<_It>>, + invoke_result_t<_Fp&, iter_reference_t<_It>>>; template <class _Fp, class _It> concept indirect_unary_predicate = - indirectly_readable<_It> && copy_constructible<_Fp> && predicate<_Fp&, iter_value_t<_It>&> && - predicate<_Fp&, iter_reference_t<_It>> && predicate<_Fp&, iter_common_reference_t<_It>>; + indirectly_readable<_It> && copy_constructible<_Fp> && predicate<_Fp&, __indirect_value_t<_It>> && + predicate<_Fp&, iter_reference_t<_It>>; template <class _Fp, class _It1, class _It2> concept indirect_binary_predicate = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> && - predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> && - predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> && - predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> && - predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> && - predicate<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; + predicate<_Fp&, __indirect_value_t<_It1>, __indirect_value_t<_It2>> && + predicate<_Fp&, __indirect_value_t<_It1>, iter_reference_t<_It2>> && + predicate<_Fp&, iter_reference_t<_It1>, __indirect_value_t<_It2>> && + predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>; template <class _Fp, class _It1, class _It2 = _It1> concept indirect_equivalence_relation = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> && - equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> && - equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> && - equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> && - equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> && - equivalence_relation<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; + equivalence_relation<_Fp&, __indirect_value_t<_It1>, __indirect_value_t<_It2>> && + equivalence_relation<_Fp&, __indirect_value_t<_It1>, iter_reference_t<_It2>> && + equivalence_relation<_Fp&, iter_reference_t<_It1>, __indirect_value_t<_It2>> && + equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>; template <class _Fp, class _It1, class _It2 = _It1> concept indirect_strict_weak_order = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> && - strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> && - strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> && - strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> && - strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>> && - strict_weak_order<_Fp&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; + strict_weak_order<_Fp&, __indirect_value_t<_It1>, __indirect_value_t<_It2>> && + strict_weak_order<_Fp&, __indirect_value_t<_It1>, iter_reference_t<_It2>> && + strict_weak_order<_Fp&, iter_reference_t<_It1>, __indirect_value_t<_It2>> && + strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>; template <class _Fp, class... _Its> requires(indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...> diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h index ea2832e3b97..d461427ccea 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/counted_iterator.h @@ -11,6 +11,7 @@ #define _LIBCPP___ITERATOR_COUNTED_ITERATOR_H #include <__assert> +#include <__compare/ordering.h> #include <__concepts/assignable.h> #include <__concepts/common_with.h> #include <__concepts/constructible.h> @@ -28,7 +29,6 @@ #include <__type_traits/add_pointer.h> #include <__type_traits/conditional.h> #include <__utility/move.h> -#include <compare> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -249,7 +249,7 @@ public: return __rhs.__count_ <=> __lhs.__count_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> + _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) requires input_iterator<_Iter> { diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/distance.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/distance.h index 75bd49c9ae7..1732aa527f6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/distance.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/distance.h @@ -52,9 +52,7 @@ distance(_InputIter __first, _InputIter __last) { // [range.iter.op.distance] namespace ranges { -namespace __distance { - -struct __fn { +struct __distance { template <class _Ip, sentinel_for<_Ip> _Sp> requires(!sized_sentinel_for<_Sp, _Ip>) _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const { @@ -85,10 +83,8 @@ struct __fn { } }; -} // namespace __distance - inline namespace __cpo { -inline constexpr auto distance = __distance::__fn{}; +inline constexpr auto distance = __distance{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h index 11af9e30184..4d9ad480cc4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h @@ -24,6 +24,8 @@ #include <__type_traits/common_reference.h> #include <__type_traits/conditional.h> #include <__type_traits/disjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_convertible.h> #include <__type_traits/is_object.h> #include <__type_traits/is_primary_template.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h index 5d9095622f4..0ee3b300b16 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h @@ -41,9 +41,7 @@ next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = // [range.iter.op.next] namespace ranges { -namespace __next { - -struct __fn { +struct __next { template <input_or_output_iterator _Ip> _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { ++__x; @@ -69,10 +67,8 @@ struct __fn { } }; -} // namespace __next - inline namespace __cpo { -inline constexpr auto next = __next::__fn{}; +inline constexpr auto next = __next{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h index dda0094dc3f..401b6f3f236 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h @@ -11,10 +11,13 @@ #define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H #include <__config> +#include <__fwd/ios.h> +#include <__fwd/ostream.h> +#include <__fwd/streambuf.h> #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> #include <cstddef> -#include <iosfwd> // for forward declaration of basic_streambuf +#include <iosfwd> // for forward declaration of ostreambuf_iterator #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h index 333939c091f..9a38b67b85d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/prev.h @@ -40,9 +40,7 @@ prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = // [range.iter.op.prev] namespace ranges { -namespace __prev { - -struct __fn { +struct __prev { template <bidirectional_iterator _Ip> _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { --__x; @@ -62,10 +60,8 @@ struct __fn { } }; -} // namespace __prev - inline namespace __cpo { -inline constexpr auto prev = __prev::__fn{}; +inline constexpr auto prev = __prev{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/projected.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/projected.h index 463d07b0d33..1c560ec0550 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/projected.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/projected.h @@ -26,6 +26,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _It, class _Proj> struct __projected_impl { struct __type { + using __primary_template = __type; + using __projected_iterator = _It; + using __projected_projection = _Proj; + using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>; indirect_result_t<_Proj&, _It> operator*() const; // not defined }; @@ -34,6 +38,10 @@ struct __projected_impl { template <weakly_incrementable _It, class _Proj> struct __projected_impl<_It, _Proj> { struct __type { + using __primary_template = __type; + using __projected_iterator = _It; + using __projected_projection = _Proj; + using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>; using difference_type = iter_difference_t<_It>; indirect_result_t<_Proj&, _It> operator*() const; // not defined diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h index 252d13b26c9..549d8ff2dbd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h @@ -10,11 +10,14 @@ #ifndef _LIBCPP___ITERATOR_WRAP_ITER_H #define _LIBCPP___ITERATOR_WRAP_ITER_H +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include <__memory/pointer_traits.h> #include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_convertible.h> #include <cstddef> @@ -131,6 +134,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC return __x.base() < __y.base(); } +#if _LIBCPP_STD_VER <= 17 template <class _Iter1> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { @@ -142,7 +146,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__x == __y); } - template <class _Iter1> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { @@ -179,6 +182,24 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX return !(__y < __x); } +#else +template <class _Iter1, class _Iter2> +_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering +operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { + if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) { + return __x.base() <=> __y.base(); + } else { + if (__x.base() < __y.base()) + return strong_ordering::less; + + if (__x.base() == __y.base()) + return strong_ordering::equal; + + return strong_ordering::greater; + } +} +#endif // _LIBCPP_STD_VER >= 20 + template <class _Iter1, class _Iter2> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 #ifndef _LIBCPP_CXX03_LANG diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h index 01af2019442..fa3bc1c3633 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h +++ b/contrib/libs/cxxsupp/libcxx/include/__locale_dir/locale_base_api/ibm.h @@ -82,7 +82,7 @@ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t locale) { inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char* fmt, va_list ap) { const size_t buff_size = 256; - if ((*strp = (char*)malloc(buff_size)) == NULL) { + if ((*strp = (char*)malloc(buff_size)) == nullptr) { return -1; } @@ -97,7 +97,7 @@ _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char va_end(ap_copy); if ((size_t)str_size >= buff_size) { - if ((*strp = (char*)realloc(*strp, str_size + 1)) == NULL) { + if ((*strp = (char*)realloc(*strp, str_size + 1)) == nullptr) { return -1; } str_size = vsnprintf(*strp, str_size + 1, fmt, ap); diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/abs.h b/contrib/libs/cxxsupp/libcxx/include/__math/abs.h index ab82a2800f5..fc3bf3a2c7c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/abs.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/abs.h @@ -23,19 +23,19 @@ namespace __math { // fabs -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT { return __builtin_fabsf(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT { return __builtin_fabsf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { return __builtin_fabs(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT { return __builtin_fabsl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double fabs(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double fabs(_A1 __x) _NOEXCEPT { return __builtin_fabs((double)__x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/copysign.h b/contrib/libs/cxxsupp/libcxx/include/__math/copysign.h index b38690bb581..c3ca6a3b037 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/copysign.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/copysign.h @@ -13,7 +13,6 @@ #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/promote.h> -#include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -25,16 +24,16 @@ namespace __math { // copysign -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { return ::__builtin_copysignf(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { return ::__builtin_copysignl(__x, __y); } template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type copysign(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type copysign(_A1 __x, _A2 __y) _NOEXCEPT { return ::__builtin_copysign(__x, __y); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/hypot.h b/contrib/libs/cxxsupp/libcxx/include/__math/hypot.h index 1bf193a9ab7..b2bf8e11c8e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/hypot.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/hypot.h @@ -10,15 +10,23 @@ #define _LIBCPP___MATH_HYPOT_H #include <__config> +#include <__math/abs.h> +#include <__math/exponential_functions.h> +#include <__math/min_max.h> +#include <__math/roots.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_same.h> #include <__type_traits/promote.h> +#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 namespace __math { @@ -41,8 +49,60 @@ inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _ return __math::hypot((__result_type)__x, (__result_type)__y); } +#if _LIBCPP_STD_VER >= 17 +// Computes the three-dimensional hypotenuse: `std::hypot(x,y,z)`. +// The naive implementation might over-/underflow which is why this implementation is more involved: +// If the square of an argument might run into issues, we scale the arguments appropriately. +// See https://github.com/llvm/llvm-project/issues/92782 for a detailed discussion and summary. +template <class _Real> +_LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) { + // Factors needed to determine if over-/underflow might happen + constexpr int __exp = std::numeric_limits<_Real>::max_exponent / 2; + const _Real __overflow_threshold = __math::ldexp(_Real(1), __exp); + const _Real __overflow_scale = __math::ldexp(_Real(1), -(__exp + 20)); + + // Scale arguments depending on their size + const _Real __max_abs = __math::fmax(__math::fabs(__x), __math::fmax(__math::fabs(__y), __math::fabs(__z))); + _Real __scale; + if (__max_abs > __overflow_threshold) { // x*x + y*y + z*z might overflow + __scale = __overflow_scale; + } else if (__max_abs < 1 / __overflow_threshold) { // x*x + y*y + z*z might underflow + __scale = 1 / __overflow_scale; + } else { + __scale = 1; + } + __x *= __scale; + __y *= __scale; + __z *= __scale; + + // Compute hypot of scaled arguments and undo scaling + return __math::sqrt(__x * __x + __y * __y + __z * __z) / __scale; +} + +inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { return __math::__hypot(__x, __y, __z); } + +inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { return __math::__hypot(__x, __y, __z); } + +inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) { + return __math::__hypot(__x, __y, __z); +} + +template <class _A1, + class _A2, + class _A3, + std::enable_if_t< is_arithmetic_v<_A1> && is_arithmetic_v<_A2> && is_arithmetic_v<_A3>, int> = 0 > +_LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type hypot(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT { + using __result_type = typename __promote<_A1, _A2, _A3>::type; + static_assert(!( + std::is_same_v<_A1, __result_type> && std::is_same_v<_A2, __result_type> && std::is_same_v<_A3, __result_type>)); + return __math::__hypot( + static_cast<__result_type>(__x), static_cast<__result_type>(__y), static_cast<__result_type>(__z)); +} +#endif + } // namespace __math _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS #endif // _LIBCPP___MATH_HYPOT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/min_max.h b/contrib/libs/cxxsupp/libcxx/include/__math/min_max.h index 27997b44910..db900c849e7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/min_max.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/min_max.h @@ -25,21 +25,21 @@ namespace __math { // fmax -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT { return __builtin_fmaxf(__x, __y); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { return __builtin_fmax(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT { return __builtin_fmaxl(__x, __y); } template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmax(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmax(_A1 __x, _A2 __y) _NOEXCEPT { using __result_type = typename __promote<_A1, _A2>::type; static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), ""); return __math::fmax((__result_type)__x, (__result_type)__y); @@ -47,21 +47,21 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::typ // fmin -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT { return __builtin_fminf(__x, __y); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { return __builtin_fmin(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT { return __builtin_fminl(__x, __y); } template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmin(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmin(_A1 __x, _A2 __y) _NOEXCEPT { using __result_type = typename __promote<_A1, _A2>::type; static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), ""); return __math::fmin((__result_type)__x, (__result_type)__y); diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/remainder.h b/contrib/libs/cxxsupp/libcxx/include/__math/remainder.h index 0fbf0b8ef97..0adb7f3af5d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/remainder.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/remainder.h @@ -14,7 +14,6 @@ #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_same.h> #include <__type_traits/promote.h> -#include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/roots.h b/contrib/libs/cxxsupp/libcxx/include/__math/roots.h index 359fd747cfb..cef376fb008 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/roots.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/roots.h @@ -39,19 +39,19 @@ inline _LIBCPP_HIDE_FROM_ABI double sqrt(_A1 __x) _NOEXCEPT { // cbrt -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT { return __builtin_cbrtf(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT { return __builtin_cbrtf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { return __builtin_cbrt(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT { return __builtin_cbrtl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double cbrt(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double cbrt(_A1 __x) _NOEXCEPT { return __builtin_cbrt((double)__x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/rounding_functions.h b/contrib/libs/cxxsupp/libcxx/include/__math/rounding_functions.h index f7246ba7fed..474f585a62f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/rounding_functions.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/rounding_functions.h @@ -26,37 +26,37 @@ namespace __math { // ceil -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT { return __builtin_ceilf(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT { return __builtin_ceilf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { return __builtin_ceil(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT { return __builtin_ceill(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double ceil(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double ceil(_A1 __x) _NOEXCEPT { return __builtin_ceil((double)__x); } // floor -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT { return __builtin_floorf(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT { return __builtin_floorf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { return __builtin_floor(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT { return __builtin_floorl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double floor(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double floor(_A1 __x) _NOEXCEPT { return __builtin_floor((double)__x); } @@ -126,21 +126,21 @@ inline _LIBCPP_HIDE_FROM_ABI long lround(_A1 __x) _NOEXCEPT { // nearbyint -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT { return __builtin_nearbyintf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { return __builtin_nearbyint(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT { return __builtin_nearbyintl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double nearbyint(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double nearbyint(_A1 __x) _NOEXCEPT { return __builtin_nearbyint((double)__x); } @@ -186,55 +186,55 @@ inline _LIBCPP_HIDE_FROM_ABI double nexttoward(_A1 __x, long double __y) _NOEXCE // rint -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { return __builtin_rintf(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { return __builtin_rintf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { return __builtin_rint(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { return __builtin_rintl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double rint(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double rint(_A1 __x) _NOEXCEPT { return __builtin_rint((double)__x); } // round -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { return __builtin_round(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { return __builtin_round(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { return __builtin_round(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { return __builtin_roundl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double round(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double round(_A1 __x) _NOEXCEPT { return __builtin_round((double)__x); } // trunc -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { return __builtin_trunc(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { return __builtin_trunc(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { return __builtin_trunc(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { return __builtin_truncl(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double trunc(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double trunc(_A1 __x) _NOEXCEPT { return __builtin_trunc((double)__x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/special_functions.h b/contrib/libs/cxxsupp/libcxx/include/__math/special_functions.h new file mode 100644 index 00000000000..0b1c753a659 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__math/special_functions.h @@ -0,0 +1,84 @@ +// -*- 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___MATH_SPECIAL_FUNCTIONS_H +#define _LIBCPP___MATH_SPECIAL_FUNCTIONS_H + +#include <__config> +#include <__math/copysign.h> +#include <__math/traits.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_integral.h> +#include <limits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +template <class _Real> +_LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) { + // The Hermite polynomial H_n(x). + // The implementation is based on the recurrence formula: H_{n+1}(x) = 2x H_n(x) - 2n H_{n-1}. + // Press, William H., et al. Numerical recipes 3rd edition: The art of scientific computing. + // Cambridge university press, 2007, p. 183. + + // NOLINTBEGIN(readability-identifier-naming) + if (__math::isnan(__x)) + return __x; + + _Real __H_0{1}; + if (__n == 0) + return __H_0; + + _Real __H_n_prev = __H_0; + _Real __H_n = 2 * __x; + for (unsigned __i = 1; __i < __n; ++__i) { + _Real __H_n_next = 2 * (__x * __H_n - __i * __H_n_prev); + __H_n_prev = __H_n; + __H_n = __H_n_next; + } + + if (!__math::isfinite(__H_n)) { + // Overflow occured. Two possible cases: + // n is odd: return infinity of the same sign as x. + // n is even: return +Inf + _Real __inf = std::numeric_limits<_Real>::infinity(); + return (__n & 1) ? __math::copysign(__inf, __x) : __inf; + } + return __H_n; + // NOLINTEND(readability-identifier-naming) +} + +inline _LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, double __x) { return std::__hermite(__n, __x); } + +inline _LIBCPP_HIDE_FROM_ABI float hermite(unsigned __n, float __x) { + // use double internally -- float is too prone to overflow! + return static_cast<float>(std::hermite(__n, static_cast<double>(__x))); +} + +inline _LIBCPP_HIDE_FROM_ABI long double hermite(unsigned __n, long double __x) { return std::__hermite(__n, __x); } + +inline _LIBCPP_HIDE_FROM_ABI float hermitef(unsigned __n, float __x) { return std::hermite(__n, __x); } + +inline _LIBCPP_HIDE_FROM_ABI long double hermitel(unsigned __n, long double __x) { return std::hermite(__n, __x); } + +template <class _Integer, std::enable_if_t<std::is_integral_v<_Integer>, int> = 0> +_LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, _Integer __x) { + return std::hermite(__n, static_cast<double>(__x)); +} + +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___MATH_SPECIAL_FUNCTIONS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__math/traits.h b/contrib/libs/cxxsupp/libcxx/include/__math/traits.h index 9fdf4096b2e..4ce554ddbe6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__math/traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__math/traits.h @@ -12,11 +12,9 @@ #include <__config> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> -#include <__type_traits/is_floating_point.h> #include <__type_traits/is_integral.h> #include <__type_traits/is_signed.h> #include <__type_traits/promote.h> -#include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -28,103 +26,131 @@ namespace __math { // signbit -template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { +// TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped. +#if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit) +# define _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_CONSTEXPR_SINCE_CXX23 +#else +# define _LIBCPP_SIGNBIT_CONSTEXPR +#endif + +// The universal C runtime (UCRT) in the WinSDK provides floating point overloads +// for std::signbit(). By defining our overloads as templates, we can work around +// this issue as templates are less preferred than non-template functions. +template <class = void> +[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(float __x) _NOEXCEPT { + return __builtin_signbit(__x); +} + +template <class = void> +[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(double __x) _NOEXCEPT { + return __builtin_signbit(__x); +} + +template <class = void> +[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(long double __x) _NOEXCEPT { return __builtin_signbit(__x); } template <class _A1, __enable_if_t<is_integral<_A1>::value && is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __x < 0; } template <class _A1, __enable_if_t<is_integral<_A1>::value && !is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { return false; } // isfinite -template <class _A1, __enable_if_t<is_arithmetic<_A1>::value && numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT { - return __builtin_isfinite((typename __promote<_A1>::type)__x); +template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { + return true; } -template <class _A1, __enable_if_t<is_arithmetic<_A1>::value && !numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { - return true; +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(float __x) _NOEXCEPT { + return __builtin_isfinite(__x); } -// isinf +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(double __x) _NOEXCEPT { + return __builtin_isfinite(__x); +} -template <class _A1, __enable_if_t<is_arithmetic<_A1>::value && numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { - return __builtin_isinf((typename __promote<_A1>::type)__x); +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(long double __x) _NOEXCEPT { + return __builtin_isfinite(__x); } -template <class _A1, __enable_if_t<is_arithmetic<_A1>::value && !numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1) _NOEXCEPT { +// isinf + +template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1) _NOEXCEPT { return false; } -#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__) -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { return __builtin_isinf(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool -isinf(double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__) +_LIBCPP_PREFERRED_OVERLOAD +#endif + bool + isinf(double __x) _NOEXCEPT { return __builtin_isinf(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { return __builtin_isinf(__x); } -#endif // isnan -template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { - return __builtin_isnan(__x); -} - template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { return false; } -#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__) -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { return __builtin_isnan(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool -isnan(double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI +#ifdef _LIBCPP_PREFERRED_OVERLOAD && !defined(__CUDACC__) +_LIBCPP_PREFERRED_OVERLOAD +#endif + bool + isnan(double __x) _NOEXCEPT { return __builtin_isnan(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { return __builtin_isnan(__x); } -#endif // isnormal -template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { +template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { + return __x != 0; +} + +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(float __x) _NOEXCEPT { return __builtin_isnormal(__x); } -template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { - return __x != 0; +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(double __x) _NOEXCEPT { + return __builtin_isnormal(__x); +} + +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(long double __x) _NOEXCEPT { + return __builtin_isnormal(__x); } // isgreater template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_isgreater((type)__x, (type)__y); } @@ -132,7 +158,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) // isgreaterequal template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_isgreaterequal((type)__x, (type)__y); } @@ -140,7 +166,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 // isless template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_isless((type)__x, (type)__y); } @@ -148,7 +174,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NO // islessequal template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_islessequal((type)__x, (type)__y); } @@ -156,7 +182,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y // islessgreater template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_islessgreater((type)__x, (type)__y); } @@ -164,7 +190,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 _ // isunordered template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { using type = typename __promote<_A1, _A2>::type; return __builtin_isunordered((type)__x, (type)__y); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__mdspan/extents.h b/contrib/libs/cxxsupp/libcxx/include/__mdspan/extents.h index fea0decd8c6..3d2c2771a83 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mdspan/extents.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mdspan/extents.h @@ -19,6 +19,8 @@ #include <__assert> #include <__config> + +#include <__concepts/arithmetic.h> #include <__type_traits/common_type.h> #include <__type_traits/is_convertible.h> #include <__type_traits/is_nothrow_constructible.h> @@ -282,8 +284,7 @@ public: using size_type = make_unsigned_t<index_type>; using rank_type = size_t; - static_assert(is_integral<index_type>::value && !is_same<index_type, bool>::value, - "extents::index_type must be a signed or unsigned integer type"); + static_assert(__libcpp_integer<index_type>, "extents::index_type must be a signed or unsigned integer type"); static_assert(((__mdspan_detail::__is_representable_as<index_type>(_Extents) || (_Extents == dynamic_extent)) && ...), "extents ctor: arguments must be representable as index_type and nonnegative"); @@ -448,12 +449,18 @@ struct __make_dextents< _IndexType, 0, extents<_IndexType, _ExtentsPack...>> { using type = extents<_IndexType, _ExtentsPack...>; }; -} // end namespace __mdspan_detail +} // namespace __mdspan_detail // [mdspan.extents.dextents], alias template template <class _IndexType, size_t _Rank> using dextents = typename __mdspan_detail::__make_dextents<_IndexType, _Rank>::type; +# if _LIBCPP_STD_VER >= 26 +// [mdspan.extents.dims], alias template `dims` +template <size_t _Rank, class _IndexType = size_t> +using dims = dextents<_IndexType, _Rank>; +# endif + // Deduction guide for extents # if _LIBCPP_STD_VER >= 26 template <class... _IndexTypes> diff --git a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_left.h b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_left.h index d058cbccffd..59574e83b0d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_left.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_left.h @@ -21,6 +21,7 @@ #include <__config> #include <__fwd/mdspan.h> #include <__mdspan/extents.h> +#include <__type_traits/common_type.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> #include <__type_traits/is_nothrow_constructible.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_right.h b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_right.h index 6842e9dc37f..d1acdb41238 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_right.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_right.h @@ -21,6 +21,7 @@ #include <__config> #include <__fwd/mdspan.h> #include <__mdspan/extents.h> +#include <__type_traits/common_type.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> #include <__type_traits/is_nothrow_constructible.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_stride.h b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_stride.h index 86148ac849e..c57f596431c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_stride.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mdspan/layout_stride.h @@ -18,12 +18,16 @@ #define _LIBCPP___MDSPAN_LAYOUT_STRIDE_H #include <__assert> +#include <__concepts/same_as.h> #include <__config> #include <__fwd/mdspan.h> #include <__mdspan/extents.h> +#include <__type_traits/common_type.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_same.h> #include <__utility/as_const.h> #include <__utility/integer_sequence.h> #include <__utility/swap.h> @@ -31,6 +35,7 @@ #include <cinttypes> #include <cstddef> #include <limits> +#include <span> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h index df73d9a2e94..a10e4fbaead 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocate_at_least.h @@ -35,7 +35,7 @@ struct __allocation_result { }; template <class _Alloc> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __allocation_result<typename allocator_traits<_Alloc>::pointer> __allocate_at_least(_Alloc& __alloc, size_t __n) { return {__alloc.allocate(__n), __n}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h index c276b4542e0..e100e45633c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h @@ -47,23 +47,7 @@ public: typedef allocator<_Up> other; }; }; - -// TODO(LLVM 20): Remove the escape hatch -# ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST -template <> -class _LIBCPP_TEMPLATE_VIS allocator<const void> { -public: - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const void value_type; - - template <class _Up> - struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { - typedef allocator<_Up> other; - }; -}; -# endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST -#endif // _LIBCPP_STD_VER <= 17 +#endif // _LIBCPP_STD_VER <= 17 // This class provides a non-trivial default constructor to the class that derives from it // if the condition is satisfied. @@ -109,7 +93,8 @@ public: template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {} - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) { + static_assert(sizeof(_Tp) >= 0, "cannot allocate memory for an incomplete type"); if (__n > allocator_traits<allocator>::max_size(*this)) __throw_bad_array_new_length(); if (__libcpp_is_constant_evaluated()) { @@ -121,6 +106,7 @@ public: #if _LIBCPP_STD_VER >= 23 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) { + static_assert(sizeof(_Tp) >= 0, "cannot allocate memory for an incomplete type"); return {allocate(__n), __n}; } #endif @@ -152,7 +138,7 @@ public: return std::addressof(__x); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) { return allocate(__n); } @@ -169,85 +155,6 @@ public: #endif }; -// TODO(LLVM 20): Remove the escape hatch -#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST -template <class _Tp> -class _LIBCPP_TEMPLATE_VIS allocator<const _Tp> - : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> > { - static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types"); - -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef const _Tp value_type; - typedef true_type propagate_on_container_move_assignment; -# if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) - _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; -# endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; - - template <class _Up> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {} - - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) { - if (__n > allocator_traits<allocator>::max_size(*this)) - __throw_bad_array_new_length(); - if (__libcpp_is_constant_evaluated()) { - return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp))); - } else { - return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); - } - } - -# if _LIBCPP_STD_VER >= 23 - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) { - return {allocate(__n), __n}; - } -# endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) { - if (__libcpp_is_constant_evaluated()) { - ::operator delete(const_cast<_Tp*>(__p)); - } else { - std::__libcpp_deallocate((void*)const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); - } - } - - // C++20 Removed members -# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; - - template <class _Up> - struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { - typedef allocator<_Up> other; - }; - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT { - return std::addressof(__x); - } - - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) { - return allocate(__n); - } - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { - return size_type(~0) / sizeof(_Tp); - } - - template <class _Up, class... _Args> - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) { - ::new ((void*)__p) _Up(std::forward<_Args>(__args)...); - } - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } -# endif -}; -#endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST - template <class _Tp, class _Up> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT { @@ -263,6 +170,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const allocator<_Tp>&, const alloca #endif +#include <__memory/allocator_const.h> + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___MEMORY_ALLOCATOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_const.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_const.h new file mode 100644 index 00000000000..e8fa49fd18e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_const.h @@ -0,0 +1,79 @@ +// kept old implementation + +#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST +template <class _Tp> +class _LIBCPP_TEMPLATE_VIS allocator<const _Tp> + : private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> > { + static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types"); + +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef const _Tp value_type; + typedef true_type propagate_on_container_move_assignment; +# if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) + _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; +# endif + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; + + template <class _Up> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {} + + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) { + if (__n > allocator_traits<allocator>::max_size(*this)) + __throw_bad_array_new_length(); + if (__libcpp_is_constant_evaluated()) { + return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp))); + } else { + return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); + } + } + +# if _LIBCPP_STD_VER >= 23 + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) { + return {allocate(__n), __n}; + } +# endif + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) { + if (__libcpp_is_constant_evaluated()) { + ::operator delete(const_cast<_Tp*>(__p)); + } else { + std::__libcpp_deallocate((void*)const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); + } + } + + // C++20 Removed members +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) + _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; + _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; + _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference; + _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; + + template <class _Up> + struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { + typedef allocator<_Up> other; + }; + + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT { + return std::addressof(__x); + } + + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) { + return allocate(__n); + } + + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { + return size_type(~0) / sizeof(_Tp); + } + + template <class _Up, class... _Args> + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) { + ::new ((void*)__p) _Up(std::forward<_Args>(__args)...); + } + + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } +# endif +}; +#endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST
\ No newline at end of file diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h index ac564f0e6fa..f4d9679807a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h @@ -11,6 +11,7 @@ #define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H #include <__config> +#include <__fwd/memory.h> #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> #include <__type_traits/enable_if.h> @@ -41,7 +42,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD struct NAME<_Tp, __void_t<typename _Tp::PROPERTY > > : true_type {} // __pointer -_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer); template <class _Tp, class _Alloc, class _RawAlloc = __libcpp_remove_reference_t<_Alloc>, @@ -276,13 +276,13 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { }; #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n) { return __a.allocate(__n); } template <class _Ap = _Alloc, __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0> - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.allocate(__n, __hint); @@ -291,7 +291,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { template <class _Ap = _Alloc, class = void, __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value, int> = 0> - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) { return __a.allocate(__n); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h b/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h index 526eb3334f9..c7ba2a99c7e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/assume_aligned.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <size_t _Np, class _Tp> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __assume_aligned(_Tp* __ptr) { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __assume_aligned(_Tp* __ptr) { static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two"); if (__libcpp_is_constant_evaluated()) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h b/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h index 40e5cfc35fb..629e3ad8848 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/compressed_pair.h @@ -11,161 +11,80 @@ #define _LIBCPP___MEMORY_COMPRESSED_PAIR_H #include <__config> -#include <__fwd/tuple.h> -#include <__tuple/tuple_indices.h> -#include <__type_traits/decay.h> -#include <__type_traits/dependent_type.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_constructible.h> +#include <__type_traits/datasizeof.h> #include <__type_traits/is_empty.h> #include <__type_traits/is_final.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_swappable.h> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <__utility/piecewise_construct.h> -#include <cstddef> +#include <__type_traits/is_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -// Tag used to default initialize one or both of the pair's elements. -struct __default_init_tag {}; -struct __value_init_tag {}; - -template <class _Tp, int _Idx, bool _CanBeEmptyBase = is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value> -struct __compressed_pair_elem { - using _ParamT = _Tp; - using reference = _Tp&; - using const_reference = const _Tp&; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {} - - template <class _Up, __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) - : __value_(std::forward<_Up>(__u)) {} - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args, size_t... _Indices> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair_elem( - piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) - : __value_(std::forward<_Args>(std::get<_Indices>(__args))...) {} -#endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return __value_; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return __value_; } - -private: - _Tp __value_; -}; - -template <class _Tp, int _Idx> -struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { - using _ParamT = _Tp; - using reference = _Tp&; - using const_reference = const _Tp&; - using __value_type = _Tp; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem() = default; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {} - - template <class _Up, __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) - : __value_type(std::forward<_Up>(__u)) {} - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args, size_t... _Indices> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 - __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) - : __value_type(std::forward<_Args>(std::get<_Indices>(__args))...) {} -#endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return *this; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return *this; } -}; +// ================================================================================================================== // +// The utilites here are for staying ABI compatible with the legacy `__compressed_pair`. They should not be used // +// for new data structures. Use `_LIBCPP_NO_UNIQUE_ADDRESS` for new data structures instead (but make sure you // +// understand how it works). // +// ================================================================================================================== // -template <class _T1, class _T2> -class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __compressed_pair_elem<_T2, 1> { -public: - // NOTE: This static assert should never fire because __compressed_pair - // is *almost never* used in a scenario where it's possible for T1 == T2. - // (The exception is std::function where it is possible that the function - // object and the allocator have the same type). - static_assert( - (!is_same<_T1, _T2>::value), - "__compressed_pair cannot be instantiated when T1 and T2 are the same type; " - "The current implementation is NOT ABI-compatible with the previous implementation for this configuration"); - - using _Base1 _LIBCPP_NODEBUG = __compressed_pair_elem<_T1, 0>; - using _Base2 _LIBCPP_NODEBUG = __compressed_pair_elem<_T2, 1>; - - template <bool _Dummy = true, - __enable_if_t< __dependent_type<is_default_constructible<_T1>, _Dummy>::value && - __dependent_type<is_default_constructible<_T2>, _Dummy>::value, - int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair() - : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {} - - template <class _U1, class _U2> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair(_U1&& __t1, _U2&& __t2) - : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} - -#ifndef _LIBCPP_CXX03_LANG - template <class... _Args1, class... _Args2> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair( - piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) - : _Base1(__pc, std::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()), - _Base2(__pc, std::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {} -#endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base1::reference first() _NOEXCEPT { - return static_cast<_Base1&>(*this).__get(); - } - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base1::const_reference first() const _NOEXCEPT { - return static_cast<_Base1 const&>(*this).__get(); - } - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base2::reference second() _NOEXCEPT { - return static_cast<_Base2&>(*this).__get(); - } - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename _Base2::const_reference second() const _NOEXCEPT { - return static_cast<_Base2 const&>(*this).__get(); - } - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base1* __get_first_base(__compressed_pair* __pair) _NOEXCEPT { - return static_cast<_Base1*>(__pair); - } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static _Base2* __get_second_base(__compressed_pair* __pair) _NOEXCEPT { - return static_cast<_Base2*>(__pair); - } - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__compressed_pair& __x) - _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) { - using std::swap; - swap(first(), __x.first()); - swap(second(), __x.second()); - } +// The first member is aligned to the alignment of the second member to force padding in front of the compressed pair +// in case there are members before it. +// +// For example: +// (assuming x86-64 linux) +// class SomeClass { +// uint32_t member1; +// _LIBCPP_COMPRESSED_PAIR(uint32_t, member2, uint64_t, member3); +// } +// +// The layout with __compressed_pair is: +// member1 - offset: 0, size: 4 +// padding - offset: 4, size: 4 +// member2 - offset: 8, size: 4 +// padding - offset: 12, size: 4 +// member3 - offset: 16, size: 8 +// +// If the [[gnu::aligned]] wasn't there, the layout would instead be: +// member1 - offset: 0, size: 4 +// member2 - offset: 4, size: 4 +// member3 - offset: 8, size: 8 + +#ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING + +template <class _ToPad> +class __compressed_pair_padding { + char __padding_[((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) || is_reference<_ToPad>::value) + ? 0 + : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; }; -template <class _T1, class _T2> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void -swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) - _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) { - __x.swap(__y); -} +# define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ + _LIBCPP_NO_UNIQUE_ADDRESS __attribute__((__aligned__(_LIBCPP_ALIGNOF(T2)))) T1 Initializer1; \ + _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ + _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ + _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _) + +# define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \ + _LIBCPP_NO_UNIQUE_ADDRESS \ + __attribute__((__aligned__(_LIBCPP_ALIGNOF(T2)), __aligned__(_LIBCPP_ALIGNOF(T3)))) T1 Initializer1; \ + _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \ + _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \ + _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \ + _LIBCPP_NO_UNIQUE_ADDRESS T3 Initializer3; \ + _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T3> _LIBCPP_CONCAT3(__padding3_, __LINE__, _) + +#else +# define _LIBCPP_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ + _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \ + _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2 + +# define _LIBCPP_COMPRESSED_TRIPLE(T1, Name1, T2, Name2, T3, Name3) \ + _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \ + _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2; \ + _LIBCPP_NO_UNIQUE_ADDRESS T3 Name3 +#endif // _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___MEMORY_COMPRESSED_PAIR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/inout_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/inout_ptr.h new file mode 100644 index 00000000000..b0e75937927 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/inout_ptr.h @@ -0,0 +1,110 @@ +// -*- 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___INOUT_PTR_H +#define _LIBCPP___INOUT_PTR_H + +#include <__config> +#include <__memory/addressof.h> +#include <__memory/pointer_traits.h> +#include <__memory/shared_ptr.h> +#include <__memory/unique_ptr.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_specialization.h> +#include <__type_traits/is_void.h> +#include <__utility/forward.h> +#include <__utility/move.h> +#include <tuple> + +#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 >= 23 + +template <class _Smart, class _Pointer, class... _Args> +class _LIBCPP_TEMPLATE_VIS inout_ptr_t { + static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr."); + +public: + _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __smart, _Args... __args) + : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_([&__smart] { + if constexpr (is_pointer_v<_Smart>) { + return __smart; + } else { + return __smart.get(); + } + }()) { + if constexpr (requires { __s_.release(); }) { + __s_.release(); + } else { + __s_ = _Smart(); + } + } + + _LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete; + + _LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() { + // LWG-3897 inout_ptr will not update raw pointer to null + if constexpr (!is_pointer_v<_Smart>) { + if (!__p_) { + return; + } + } + + using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>; + if constexpr (is_pointer_v<_Smart>) { + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, + std::move(__a_)); + } else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) { + std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, + std::move(__a_)); + } else { + static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>, + "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args..."); + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, + std::move(__a_)); + } + } + + _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); } + + _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept + requires(!is_same_v<_Pointer, void*>) + { + static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer."); + + return reinterpret_cast<void**>(static_cast<_Pointer*>(*this)); + } + +private: + _Smart& __s_; + tuple<_Args...> __a_; + _Pointer __p_; +}; + +template <class _Pointer = void, class _Smart, class... _Args> +_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) { + using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>; + return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); +} + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___INOUT_PTR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/noexcept_move_assign_container.h b/contrib/libs/cxxsupp/libcxx/include/__memory/noexcept_move_assign_container.h index baaf36d9980..b0063516aaa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/noexcept_move_assign_container.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/noexcept_move_assign_container.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H -#define _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H +#ifndef _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H +#define _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H #include <__config> #include <__memory/allocator_traits.h> @@ -34,4 +34,4 @@ struct __noexcept_move_assign_container _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___TYPE_TRAITS_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H +#endif // _LIBCPP___MEMORY_NOEXCEPT_MOVE_ASSIGN_CONTAINER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/out_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/out_ptr.h new file mode 100644 index 00000000000..030a4c3b0ed --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/out_ptr.h @@ -0,0 +1,102 @@ +// -*- 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___OUT_PTR_H +#define _LIBCPP___OUT_PTR_H + +#include <__config> +#include <__memory/addressof.h> +#include <__memory/pointer_traits.h> +#include <__memory/shared_ptr.h> +#include <__memory/unique_ptr.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_specialization.h> +#include <__type_traits/is_void.h> +#include <__utility/forward.h> +#include <__utility/move.h> +#include <tuple> + +#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 >= 23 + +template <class _Smart, class _Pointer, class... _Args> +class _LIBCPP_TEMPLATE_VIS out_ptr_t { + static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0, + "Using std::shared_ptr<> without a deleter in std::out_ptr is not supported."); + +public: + _LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __smart, _Args... __args) + : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_() { + using _Ptr = decltype(__smart); + if constexpr (__resettable_smart_pointer<_Ptr>) { + __s_.reset(); + } else if constexpr (is_constructible_v<_Smart>) { + __s_ = _Smart(); + } else { + static_assert(__resettable_smart_pointer<_Ptr> || is_constructible_v<_Smart>, + "The adapted pointer type must have a reset() member function or be default constructible."); + } + } + + _LIBCPP_HIDE_FROM_ABI out_ptr_t(const out_ptr_t&) = delete; + + _LIBCPP_HIDE_FROM_ABI ~out_ptr_t() { + if (!__p_) { + return; + } + + using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>; + if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) { + std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, + std::move(__a_)); + } else { + static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>, + "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args..."); + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, + std::move(__a_)); + } + } + + _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); } + + _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept + requires(!is_same_v<_Pointer, void*>) + { + static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer."); + + return reinterpret_cast<void**>(static_cast<_Pointer*>(*this)); + } + +private: + _Smart& __s_; + tuple<_Args...> __a_; + _Pointer __p_ = _Pointer(); +}; + +template <class _Pointer = void, class _Smart, class... _Args> +_LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) { + using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>; + return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...); +} + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___OUT_PTR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h index fcd2c3edd9f..98961ddf970 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h @@ -15,24 +15,35 @@ #include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> #include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_class.h> #include <__type_traits/is_function.h> #include <__type_traits/is_void.h> #include <__type_traits/void_t.h> #include <__utility/declval.h> +#include <__utility/forward.h> #include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Tp, class = void> -struct __has_element_type : false_type {}; +// clang-format off +#define _LIBCPP_CLASS_TRAITS_HAS_XXX(NAME, PROPERTY) \ + template <class _Tp, class = void> \ + struct NAME : false_type {}; \ + template <class _Tp> \ + struct NAME<_Tp, __void_t<typename _Tp::PROPERTY> > : true_type {} +// clang-format on -template <class _Tp> -struct __has_element_type<_Tp, __void_t<typename _Tp::element_type> > : true_type {}; +_LIBCPP_CLASS_TRAITS_HAS_XXX(__has_pointer, pointer); +_LIBCPP_CLASS_TRAITS_HAS_XXX(__has_element_type, element_type); template <class _Ptr, bool = __has_element_type<_Ptr>::value> struct __pointer_traits_element_type {}; @@ -240,6 +251,59 @@ to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) { } #endif +#if _LIBCPP_STD_VER >= 23 + +template <class _Tp> +struct __pointer_of {}; + +template <class _Tp> + requires(__has_pointer<_Tp>::value) +struct __pointer_of<_Tp> { + using type = typename _Tp::pointer; +}; + +template <class _Tp> + requires(!__has_pointer<_Tp>::value && __has_element_type<_Tp>::value) +struct __pointer_of<_Tp> { + using type = typename _Tp::element_type*; +}; + +template <class _Tp> + requires(!__has_pointer<_Tp>::value && !__has_element_type<_Tp>::value && + __has_element_type<pointer_traits<_Tp>>::value) +struct __pointer_of<_Tp> { + using type = typename pointer_traits<_Tp>::element_type*; +}; + +template <typename _Tp> +using __pointer_of_t = typename __pointer_of<_Tp>::type; + +template <class _Tp, class _Up> +struct __pointer_of_or { + using type _LIBCPP_NODEBUG = _Up; +}; + +template <class _Tp, class _Up> + requires requires { typename __pointer_of_t<_Tp>; } +struct __pointer_of_or<_Tp, _Up> { + using type _LIBCPP_NODEBUG = __pointer_of_t<_Tp>; +}; + +template <typename _Tp, typename _Up> +using __pointer_of_or_t = typename __pointer_of_or<_Tp, _Up>::type; + +template <class _Smart> +concept __resettable_smart_pointer = requires(_Smart __s) { __s.reset(); }; + +template <class _Smart, class _Pointer, class... _Args> +concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p, _Args... __args) { + __s.reset(static_cast<__pointer_of_or_t<_Smart, _Pointer>>(__p), std::forward<_Args>(__args)...); +}; + +#endif + _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MEMORY_POINTER_TRAITS_H 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 f731e75e7bd..b7523d4ba4b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_construct_at.h @@ -38,43 +38,33 @@ namespace ranges { // construct_at -namespace __construct_at { - -struct __fn { +struct __construct_at { template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))> _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator()(_Tp* __location, _Args&&... __args) const { return std::construct_at(__location, std::forward<_Args>(__args)...); } }; -} // namespace __construct_at - inline namespace __cpo { -inline constexpr auto construct_at = __construct_at::__fn{}; +inline constexpr auto construct_at = __construct_at{}; } // namespace __cpo // destroy_at -namespace __destroy_at { - -struct __fn { +struct __destroy_at { template <destructible _Tp> _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept { std::destroy_at(__location); } }; -} // namespace __destroy_at - inline namespace __cpo { -inline constexpr auto destroy_at = __destroy_at::__fn{}; +inline constexpr auto destroy_at = __destroy_at{}; } // namespace __cpo // destroy -namespace __destroy { - -struct __fn { +struct __destroy { template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel> requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept { @@ -88,17 +78,13 @@ struct __fn { } }; -} // namespace __destroy - inline namespace __cpo { -inline constexpr auto destroy = __destroy::__fn{}; +inline constexpr auto destroy = __destroy{}; } // namespace __cpo // destroy_n -namespace __destroy_n { - -struct __fn { +struct __destroy_n { template <__nothrow_input_iterator _InputIterator> requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator @@ -107,10 +93,8 @@ struct __fn { } }; -} // namespace __destroy_n - inline namespace __cpo { -inline constexpr auto destroy_n = __destroy_n::__fn{}; +inline constexpr auto destroy_n = __destroy_n{}; } // namespace __cpo } // namespace ranges 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 90090055bbb..4815ac6e5de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/ranges_uninitialized_algorithms.h @@ -42,9 +42,7 @@ namespace ranges { // uninitialized_default_construct -namespace __uninitialized_default_construct { - -struct __fn { +struct __uninitialized_default_construct { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { @@ -59,17 +57,13 @@ struct __fn { } }; -} // namespace __uninitialized_default_construct - inline namespace __cpo { -inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{}; +inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct{}; } // namespace __cpo // uninitialized_default_construct_n -namespace __uninitialized_default_construct_n { - -struct __fn { +struct __uninitialized_default_construct_n { template <__nothrow_forward_iterator _ForwardIterator> requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator @@ -79,17 +73,13 @@ struct __fn { } }; -} // namespace __uninitialized_default_construct_n - inline namespace __cpo { -inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{}; +inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n{}; } // namespace __cpo // uninitialized_value_construct -namespace __uninitialized_value_construct { - -struct __fn { +struct __uninitialized_value_construct { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel> requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { @@ -104,17 +94,13 @@ struct __fn { } }; -} // namespace __uninitialized_value_construct - inline namespace __cpo { -inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{}; +inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct{}; } // namespace __cpo // uninitialized_value_construct_n -namespace __uninitialized_value_construct_n { - -struct __fn { +struct __uninitialized_value_construct_n { template <__nothrow_forward_iterator _ForwardIterator> requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator @@ -124,17 +110,13 @@ struct __fn { } }; -} // namespace __uninitialized_value_construct_n - inline namespace __cpo { -inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{}; +inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n{}; } // namespace __cpo // uninitialized_fill -namespace __uninitialized_fill { - -struct __fn { +struct __uninitialized_fill { template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp> requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const { @@ -149,17 +131,13 @@ struct __fn { } }; -} // namespace __uninitialized_fill - inline namespace __cpo { -inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{}; +inline constexpr auto uninitialized_fill = __uninitialized_fill{}; } // namespace __cpo // uninitialized_fill_n -namespace __uninitialized_fill_n { - -struct __fn { +struct __uninitialized_fill_n { template <__nothrow_forward_iterator _ForwardIterator, class _Tp> requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> _LIBCPP_HIDE_FROM_ABI _ForwardIterator @@ -169,10 +147,8 @@ struct __fn { } }; -} // namespace __uninitialized_fill_n - inline namespace __cpo { -inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{}; +inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n{}; } // namespace __cpo // uninitialized_copy @@ -180,9 +156,7 @@ inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{}; template <class _InputIterator, class _OutputIterator> using uninitialized_copy_result = in_out_result<_InputIterator, _OutputIterator>; -namespace __uninitialized_copy { - -struct __fn { +struct __uninitialized_copy { template <input_iterator _InputIterator, sentinel_for<_InputIterator> _Sentinel1, __nothrow_forward_iterator _OutputIterator, @@ -207,10 +181,8 @@ struct __fn { } }; -} // namespace __uninitialized_copy - inline namespace __cpo { -inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{}; +inline constexpr auto uninitialized_copy = __uninitialized_copy{}; } // namespace __cpo // uninitialized_copy_n @@ -218,9 +190,7 @@ inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{}; template <class _InputIterator, class _OutputIterator> using uninitialized_copy_n_result = in_out_result<_InputIterator, _OutputIterator>; -namespace __uninitialized_copy_n { - -struct __fn { +struct __uninitialized_copy_n { template <input_iterator _InputIterator, __nothrow_forward_iterator _OutputIterator, __nothrow_sentinel_for<_OutputIterator> _Sentinel> @@ -238,10 +208,8 @@ struct __fn { } }; -} // namespace __uninitialized_copy_n - inline namespace __cpo { -inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{}; +inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n{}; } // namespace __cpo // uninitialized_move @@ -249,9 +217,7 @@ inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{}; template <class _InputIterator, class _OutputIterator> using uninitialized_move_result = in_out_result<_InputIterator, _OutputIterator>; -namespace __uninitialized_move { - -struct __fn { +struct __uninitialized_move { template <input_iterator _InputIterator, sentinel_for<_InputIterator> _Sentinel1, __nothrow_forward_iterator _OutputIterator, @@ -276,10 +242,8 @@ struct __fn { } }; -} // namespace __uninitialized_move - inline namespace __cpo { -inline constexpr auto uninitialized_move = __uninitialized_move::__fn{}; +inline constexpr auto uninitialized_move = __uninitialized_move{}; } // namespace __cpo // uninitialized_move_n @@ -287,9 +251,7 @@ inline constexpr auto uninitialized_move = __uninitialized_move::__fn{}; template <class _InputIterator, class _OutputIterator> using uninitialized_move_n_result = in_out_result<_InputIterator, _OutputIterator>; -namespace __uninitialized_move_n { - -struct __fn { +struct __uninitialized_move_n { template <input_iterator _InputIterator, __nothrow_forward_iterator _OutputIterator, __nothrow_sentinel_for<_OutputIterator> _Sentinel> @@ -308,10 +270,8 @@ struct __fn { } }; -} // namespace __uninitialized_move_n - inline namespace __cpo { -inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{}; +inline constexpr auto uninitialized_move_n = __uninitialized_move_n{}; } // namespace __cpo } // namespace ranges diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h index 146b2059e8b..0c622cd918e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/shared_ptr.h @@ -34,6 +34,8 @@ #include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> #include <__type_traits/disjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_array.h> #include <__type_traits/is_bounded_array.h> #include <__type_traits/is_constructible.h> @@ -121,7 +123,7 @@ public: const char* what() const _NOEXCEPT override; }; -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_weak_ptr(); #else @@ -230,11 +232,11 @@ private: template <class _Tp, class _Dp, class _Alloc> class __shared_ptr_pointer : public __shared_weak_count { - __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_; + _LIBCPP_COMPRESSED_TRIPLE(_Tp, __ptr_, _Dp, __deleter_, _Alloc, __alloc_); public: _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) - : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {} + : __ptr_(__p), __deleter_(std::move(__d)), __alloc_(std::move(__a)) {} #ifndef _LIBCPP_HAS_NO_RTTI _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override; @@ -249,15 +251,15 @@ private: template <class _Tp, class _Dp, class _Alloc> const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { - return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr; + return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr; } #endif // _LIBCPP_HAS_NO_RTTI template <class _Tp, class _Dp, class _Alloc> void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT { - __data_.first().second()(__data_.first().first()); - __data_.first().second().~_Dp(); + __deleter_(__ptr_); + __deleter_.~_Dp(); } template <class _Tp, class _Dp, class _Alloc> @@ -266,8 +268,8 @@ void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT { typedef allocator_traits<_Al> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; - _Al __a(__data_.second()); - __data_.second().~_Alloc(); + _Al __a(__alloc_); + __alloc_.~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1); } @@ -325,36 +327,28 @@ private: allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1); } + // TODO: It should be possible to refactor this to remove `_Storage` entirely. // This class implements the control block for non-array shared pointers created // through `std::allocate_shared` and `std::make_shared`. - // - // In previous versions of the library, we used a compressed pair to store - // both the _Alloc and the _Tp. This implies using EBO, which is incompatible - // with Allocator construction for _Tp. To allow implementing P0674 in C++20, - // we now use a properly aligned char buffer while making sure that we maintain - // the same layout that we had when we used a compressed pair. - using _CompressedPair = __compressed_pair<_Alloc, _Tp>; - struct _ALIGNAS_TYPE(_CompressedPair) _Storage { - char __blob_[sizeof(_CompressedPair)]; + struct _Storage { + struct _Data { + _LIBCPP_COMPRESSED_PAIR(_Alloc, __alloc_, _Tp, __elem_); + }; + + _ALIGNAS_TYPE(_Data) char __buffer_[sizeof(_Data)]; _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); } _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); } + _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { - _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_); - typename _CompressedPair::_Base1* __first = _CompressedPair::__get_first_base(__as_pair); - _Alloc* __alloc = reinterpret_cast<_Alloc*>(__first); - return __alloc; + return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__alloc_); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* __get_elem() _NOEXCEPT { - _CompressedPair* __as_pair = reinterpret_cast<_CompressedPair*>(__blob_); - typename _CompressedPair::_Base2* __second = _CompressedPair::__get_second_base(__as_pair); - _Tp* __elem = reinterpret_cast<_Tp*>(__second); - return __elem; + return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__elem_); } }; - static_assert(_LIBCPP_ALIGNOF(_Storage) == _LIBCPP_ALIGNOF(_CompressedPair), ""); - static_assert(sizeof(_Storage) == sizeof(_CompressedPair), ""); _Storage __storage_; }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h b/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h index 88799ca95c1..219e03f99bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/temporary_buffer.h @@ -11,6 +11,7 @@ #define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H #include <__config> +#include <__memory/unique_temporary_buffer.h> #include <__utility/pair.h> #include <cstddef> #include <new> @@ -19,57 +20,27 @@ # pragma GCC system_header #endif +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER) + _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT { - pair<_Tp*, ptrdiff_t> __r(0, 0); - const ptrdiff_t __m = - (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp); - if (__n > __m) - __n = __m; - while (__n > 0) { -#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) - if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) { - align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp)); - __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), __al, nothrow)); - } else { - __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow)); - } -#else - if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) { - // Since aligned operator new is unavailable, return an empty - // buffer rather than one with invalid alignment. - return __r; - } - - __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow)); -#endif - - if (__r.first) { - __r.second = __n; - break; - } - __n /= 2; - } - return __r; + __unique_temporary_buffer<_Tp> __unique_buf = std::__allocate_unique_temporary_buffer<_Tp>(__n); + pair<_Tp*, ptrdiff_t> __result(__unique_buf.get(), __unique_buf.get_deleter().__count_); + __unique_buf.release(); + return __result; } template <class _Tp> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT { - std::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp)); + __unique_temporary_buffer<_Tp> __unique_buf(__p); + (void)__unique_buf; } -struct __return_temporary_buffer { - _LIBCPP_SUPPRESS_DEPRECATED_PUSH - template <class _Tp> - _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const { - std::return_temporary_buffer(__p); - } - _LIBCPP_SUPPRESS_DEPRECATED_POP -}; - _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER) + #endif // _LIBCPP___MEMORY_TEMPORARY_BUFFER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h index 7475ef5cf85..a8dbde0b1c0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uninitialized_algorithms.h @@ -22,6 +22,7 @@ #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> #include <__memory/voidify.h> +#include <__type_traits/enable_if.h> #include <__type_traits/extent.h> #include <__type_traits/is_array.h> #include <__type_traits/is_constant_evaluated.h> @@ -564,15 +565,12 @@ template <class _Alloc, class _In, class _RawTypeIn = __remove_const_t<_In>, class _Out, - __enable_if_t< - // using _RawTypeIn because of the allocator<T const> extension - is_trivially_copy_constructible<_RawTypeIn>::value && is_trivially_copy_assignable<_RawTypeIn>::value && - is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && - __allocator_has_trivial_copy_construct<_Alloc, _RawTypeIn>::value, - int> = 0> + __enable_if_t<is_trivially_copy_constructible<_RawTypeIn>::value && is_trivially_copy_assignable<_RawTypeIn>::value && + is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value && + __allocator_has_trivial_copy_construct<_Alloc, _In>::value, + int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Out* __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* __first2) { - // TODO: Remove the const_cast once we drop support for std::allocator<T const> if (__libcpp_is_constant_evaluated()) { while (__first1 != __last1) { std::__construct_at(std::__to_address(__first2), *__first1); @@ -581,7 +579,11 @@ __uninitialized_allocator_copy_impl(_Alloc&, _In* __first1, _In* __last1, _Out* } return __first2; } else { +#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST return std::copy(__first1, __last1, const_cast<_RawTypeIn*>(__first2)); +#else + return std::copy(__first1, __last1, __first2); +#endif } } @@ -642,7 +644,11 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _ __guard.__complete(); std::__allocator_destroy(__alloc, __first, __last); } else { +#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST __builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first)); +#else + __builtin_memcpy(__result, __first, sizeof(_Tp) * (__last - __first)); +#endif } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h index 8dd000ba0cd..73e2f37c12b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h @@ -23,6 +23,7 @@ #include <__type_traits/common_type.h> #include <__type_traits/conditional.h> #include <__type_traits/dependent_type.h> +#include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_array.h> #include <__type_traits/is_assignable.h> @@ -37,6 +38,7 @@ #include <__type_traits/is_void.h> #include <__type_traits/remove_extent.h> #include <__type_traits/type_identity.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> #include <cstddef> @@ -143,7 +145,7 @@ public: void>; private: - __compressed_pair<pointer, deleter_type> __ptr_; + _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_); typedef _LIBCPP_NODEBUG __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; @@ -177,23 +179,25 @@ private: public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT - : __ptr_(__value_init_tag(), __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT + : __ptr_(__p), + __deleter_() {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(__p, __d) {} + : __ptr_(__p), + __deleter_(__d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(__p, std::move(__d)) { + : __ptr_(__p), + __deleter_(std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } @@ -201,24 +205,26 @@ public: _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {} + : __ptr_(__u.release()), + __deleter_(std::forward<deleter_type>(__u.get_deleter())) {} template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - : __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {} + : __ptr_(__u.release()), + __deleter_(std::forward<_Ep>(__u.get_deleter())) {} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT : __ptr_(__p.release(), __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT : __ptr_(__p.release()), __deleter_() {} #endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = std::forward<deleter_type>(__u.get_deleter()); + __deleter_ = std::forward<deleter_type>(__u.get_deleter()); return *this; } @@ -228,7 +234,7 @@ public: class = _EnableIfDeleterAssignable<_Ep> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = std::forward<_Ep>(__u.get_deleter()); + __deleter_ = std::forward<_Ep>(__u.get_deleter()); return *this; } @@ -253,33 +259,38 @@ public: return *this; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const { - return *__ptr_.first(); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const + _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) { + return *__ptr_; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_.first(); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __deleter_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { - return __ptr_.second(); + return __deleter_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { - return __ptr_.first() != nullptr; + return __ptr_ != nullptr; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); + pointer __t = __ptr_; + __ptr_ = pointer(); return __t; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; + pointer __tmp = __ptr_; + __ptr_ = __p; if (__tmp) - __ptr_.second()(__tmp); + __deleter_(__tmp); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { + using std::swap; + swap(__ptr_, __u.__ptr_); + swap(__deleter_, __u.__deleter_); + } }; template <class _Tp, class _Dp> @@ -301,7 +312,7 @@ public: void>; private: - __compressed_pair<pointer, deleter_type> __ptr_; + _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_); template <class _From> struct _CheckArrayPointerConversion : is_same<_From, pointer> {}; @@ -350,42 +361,46 @@ private: public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT - : __ptr_(__value_init_tag(), __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>, class = _EnableIfPointerConvertible<_Pp> > - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT + : __ptr_(__p), + __deleter_() {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(__p, __d) {} + : __ptr_(__p), + __deleter_(__d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(nullptr, __d) {} + : __ptr_(nullptr), + __deleter_(__d) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(__p, std::move(__d)) { + : __ptr_(__p), + __deleter_(std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(nullptr, std::move(__d)) { + : __ptr_(nullptr), + __deleter_(std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } @@ -396,11 +411,12 @@ public: _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {} + : __ptr_(__u.release()), + __deleter_(std::forward<deleter_type>(__u.get_deleter())) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = std::forward<deleter_type>(__u.get_deleter()); + __deleter_ = std::forward<deleter_type>(__u.get_deleter()); return *this; } @@ -409,7 +425,8 @@ public: class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - : __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {} + : __ptr_(__u.release()), + __deleter_(std::forward<_Ep>(__u.get_deleter())) {} template <class _Up, class _Ep, @@ -417,7 +434,7 @@ public: class = _EnableIfDeleterAssignable<_Ep> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = std::forward<_Ep>(__u.get_deleter()); + __deleter_ = std::forward<_Ep>(__u.get_deleter()); return *this; } @@ -435,41 +452,45 @@ public: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator[](size_t __i) const { - return __ptr_.first()[__i]; + return __ptr_[__i]; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __deleter_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { - return __ptr_.second(); + return __deleter_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { - return __ptr_.first() != nullptr; + return __ptr_ != nullptr; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); + pointer __t = __ptr_; + __ptr_ = pointer(); return __t; } template <class _Pp, __enable_if_t<_CheckArrayPointerConversion<_Pp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(_Pp __p) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; + pointer __tmp = __ptr_; + __ptr_ = __p; if (__tmp) - __ptr_.second()(__tmp); + __deleter_(__tmp); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = nullptr; + pointer __tmp = __ptr_; + __ptr_ = nullptr; if (__tmp) - __ptr_.second()(__tmp); + __deleter_(__tmp); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { + using std::swap; + swap(__ptr_, __u.__ptr_); + swap(__deleter_, __u.__deleter_); + } }; template <class _Tp, class _Dp, __enable_if_t<__is_swappable_v<_Dp>, int> = 0> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_temporary_buffer.h b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_temporary_buffer.h new file mode 100644 index 00000000000..b9e2a473326 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_temporary_buffer.h @@ -0,0 +1,92 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H +#define _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H + +#include <__assert> +#include <__config> + +#include <__memory/allocator.h> +#include <__memory/unique_ptr.h> +#include <__type_traits/is_constant_evaluated.h> +#include <cstddef> +#include <new> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct __temporary_buffer_deleter { + ptrdiff_t __count_; // ignored in non-constant evaluation + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __temporary_buffer_deleter() _NOEXCEPT : __count_(0) {} + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR explicit __temporary_buffer_deleter(ptrdiff_t __count) _NOEXCEPT : __count_(__count) {} + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) { + allocator<_Tp>().deallocate(__ptr, __count_); + return; + } + + std::__libcpp_deallocate_unsized((void*)__ptr, _LIBCPP_ALIGNOF(_Tp)); + } +}; + +template <class _Tp> +using __unique_temporary_buffer = unique_ptr<_Tp, __temporary_buffer_deleter<_Tp> >; + +template <class _Tp> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __unique_temporary_buffer<_Tp> +__allocate_unique_temporary_buffer(ptrdiff_t __count) { + using __deleter_type = __temporary_buffer_deleter<_Tp>; + using __unique_buffer_type = __unique_temporary_buffer<_Tp>; + + if (__libcpp_is_constant_evaluated()) { + return __unique_buffer_type(allocator<_Tp>().allocate(__count), __deleter_type(__count)); + } + + _Tp* __ptr = nullptr; + const ptrdiff_t __max_count = + (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp); + if (__count > __max_count) + __count = __max_count; + while (__count > 0) { +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) + if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) { + align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp)); + __ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), __al, nothrow)); + } else { + __ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), nothrow)); + } +#else + if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) { + // Since aligned operator new is unavailable, constructs an empty buffer rather than one with invalid alignment. + return __unique_buffer_type(); + } + + __ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), nothrow)); +#endif + + if (__ptr) { + break; + } + __count /= 2; + } + + return __unique_buffer_type(__ptr, __deleter_type(__count)); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___MEMORY_UNIQUE_TEMPORARY_BUFFER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h index 84310c3fa56..16504e8b2a9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h @@ -11,6 +11,7 @@ #define _LIBCPP___MEMORY_USES_ALLOCATOR_H #include <__config> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_convertible.h> #include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator_construction.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator_construction.h index 5e5819d4c28..955879ffc58 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator_construction.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator_construction.h @@ -40,104 +40,8 @@ inline constexpr bool __is_std_pair<pair<_Type1, _Type2>> = true; template <class _Tp> inline constexpr bool __is_cv_std_pair = __is_std_pair<remove_cv_t<_Tp>>; -template <class _Type, class _Alloc, class... _Args, __enable_if_t<!__is_cv_std_pair<_Type>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept { - if constexpr (!uses_allocator_v<remove_cv_t<_Type>, _Alloc> && is_constructible_v<_Type, _Args...>) { - return std::forward_as_tuple(std::forward<_Args>(__args)...); - } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && - is_constructible_v<_Type, allocator_arg_t, const _Alloc&, _Args...>) { - return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __alloc, std::forward<_Args>(__args)...); - } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && - is_constructible_v<_Type, _Args..., const _Alloc&>) { - return std::forward_as_tuple(std::forward<_Args>(__args)..., __alloc); - } else { - static_assert( - sizeof(_Type) + 1 == 0, "If uses_allocator_v<Type> is true, the type has to be allocator-constructible"); - } -} - -template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args( - const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept { - return std::make_tuple( - piecewise_construct, - std::apply( - [&__alloc](auto&&... __args1) { - return std::__uses_allocator_construction_args<typename _Pair::first_type>( - __alloc, std::forward<decltype(__args1)>(__args1)...); - }, - std::forward<_Tuple1>(__x)), - std::apply( - [&__alloc](auto&&... __args2) { - return std::__uses_allocator_construction_args<typename _Pair::second_type>( - __alloc, std::forward<decltype(__args2)>(__args2)...); - }, - std::forward<_Tuple2>(__y))); -} - -template <class _Pair, class _Alloc, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc) noexcept { - return std::__uses_allocator_construction_args<_Pair>(__alloc, piecewise_construct, tuple<>{}, tuple<>{}); -} - -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, - piecewise_construct, - std::forward_as_tuple(std::forward<_Up>(__u)), - std::forward_as_tuple(std::forward<_Vp>(__v))); -} - -# if _LIBCPP_STD_VER >= 23 -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); -} -# endif - -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>& __pair) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); -} - -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>&& __pair) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, - piecewise_construct, - std::forward_as_tuple(std::get<0>(std::move(__pair))), - std::forward_as_tuple(std::get<1>(std::move(__pair)))); -} - -# if _LIBCPP_STD_VER >= 23 -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, - piecewise_construct, - std::forward_as_tuple(std::get<0>(std::move(__pair))), - std::forward_as_tuple(std::get<1>(std::move(__pair)))); -} - -template <class _Pair, class _Alloc, __pair_like_no_subrange _PairLike, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, _PairLike&& __p) noexcept { - return std::__uses_allocator_construction_args<_Pair>( - __alloc, - piecewise_construct, - std::forward_as_tuple(std::get<0>(std::forward<_PairLike>(__p))), - std::forward_as_tuple(std::get<1>(std::forward<_PairLike>(__p)))); -} -# endif +template <class _Tp, class = void> +struct __uses_allocator_construction_args; namespace __uses_allocator_detail { @@ -165,46 +69,135 @@ inline constexpr bool __uses_allocator_constraints = __is_cv_std_pair<_Tp> && !_ } // namespace __uses_allocator_detail -template < class _Pair, - class _Alloc, - class _Type, - __enable_if_t<__uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept; - template <class _Type, class _Alloc, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args); -template < class _Pair, - class _Alloc, - class _Type, - __enable_if_t< __uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int>> -_LIBCPP_HIDE_FROM_ABI constexpr auto -__uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept { - struct __pair_constructor { - using _PairMutable = remove_cv_t<_Pair>; +template <class _Pair> +struct __uses_allocator_construction_args<_Pair, __enable_if_t<__is_cv_std_pair<_Pair>>> { + template <class _Alloc, class _Tuple1, class _Tuple2> + static _LIBCPP_HIDE_FROM_ABI constexpr auto + __apply(const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept { + return std::make_tuple( + piecewise_construct, + std::apply( + [&__alloc](auto&&... __args1) { + return __uses_allocator_construction_args<typename _Pair::first_type>::__apply( + __alloc, std::forward<decltype(__args1)>(__args1)...); + }, + std::forward<_Tuple1>(__x)), + std::apply( + [&__alloc](auto&&... __args2) { + return __uses_allocator_construction_args<typename _Pair::second_type>::__apply( + __alloc, std::forward<decltype(__args2)>(__args2)...); + }, + std::forward<_Tuple2>(__y))); + } - _LIBCPP_HIDDEN constexpr auto __do_construct(const _PairMutable& __pair) const { - return std::__make_obj_using_allocator<_PairMutable>(__alloc_, __pair); - } + template <class _Alloc> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply(__alloc, piecewise_construct, tuple<>{}, tuple<>{}); + } - _LIBCPP_HIDDEN constexpr auto __do_construct(_PairMutable&& __pair) const { - return std::__make_obj_using_allocator<_PairMutable>(__alloc_, std::move(__pair)); - } + template <class _Alloc, class _Up, class _Vp> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, + piecewise_construct, + std::forward_as_tuple(std::forward<_Up>(__u)), + std::forward_as_tuple(std::forward<_Vp>(__v))); + } - const _Alloc& __alloc_; - _Type& __value_; +# if _LIBCPP_STD_VER >= 23 + template <class _Alloc, class _Up, class _Vp> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); + } +# endif - _LIBCPP_HIDDEN constexpr operator _PairMutable() const { return __do_construct(std::forward<_Type>(__value_)); } - }; + template <class _Alloc, class _Up, class _Vp> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, const pair<_Up, _Vp>& __pair) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); + } - return std::make_tuple(__pair_constructor{__alloc, __value}); -} + template <class _Alloc, class _Up, class _Vp> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, pair<_Up, _Vp>&& __pair) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, + piecewise_construct, + std::forward_as_tuple(std::get<0>(std::move(__pair))), + std::forward_as_tuple(std::get<1>(std::move(__pair)))); + } + +# if _LIBCPP_STD_VER >= 23 + template <class _Alloc, class _Up, class _Vp> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, + piecewise_construct, + std::forward_as_tuple(std::get<0>(std::move(__pair))), + std::forward_as_tuple(std::get<1>(std::move(__pair)))); + } + + template < class _Alloc, __pair_like_no_subrange _PairLike> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, _PairLike&& __p) noexcept { + return __uses_allocator_construction_args<_Pair>::__apply( + __alloc, + piecewise_construct, + std::forward_as_tuple(std::get<0>(std::forward<_PairLike>(__p))), + std::forward_as_tuple(std::get<1>(std::forward<_PairLike>(__p)))); + } +# endif + + template <class _Alloc, + class _Type, + __enable_if_t<__uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int> = 0> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, _Type&& __value) noexcept { + struct __pair_constructor { + using _PairMutable = remove_cv_t<_Pair>; + + _LIBCPP_HIDDEN constexpr auto __do_construct(const _PairMutable& __pair) const { + return std::__make_obj_using_allocator<_PairMutable>(__alloc_, __pair); + } + + _LIBCPP_HIDDEN constexpr auto __do_construct(_PairMutable&& __pair) const { + return std::__make_obj_using_allocator<_PairMutable>(__alloc_, std::move(__pair)); + } + + const _Alloc& __alloc_; + _Type& __value_; + + _LIBCPP_HIDDEN constexpr operator _PairMutable() const { return __do_construct(std::forward<_Type>(__value_)); } + }; + + return std::make_tuple(__pair_constructor{__alloc, __value}); + } +}; + +template <class _Type> +struct __uses_allocator_construction_args<_Type, __enable_if_t<!__is_cv_std_pair<_Type>>> { + template <class _Alloc, class... _Args> + static _LIBCPP_HIDE_FROM_ABI constexpr auto __apply(const _Alloc& __alloc, _Args&&... __args) noexcept { + if constexpr (!uses_allocator_v<remove_cv_t<_Type>, _Alloc> && is_constructible_v<_Type, _Args...>) { + return std::forward_as_tuple(std::forward<_Args>(__args)...); + } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && + is_constructible_v<_Type, allocator_arg_t, const _Alloc&, _Args...>) { + return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __alloc, std::forward<_Args>(__args)...); + } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && + is_constructible_v<_Type, _Args..., const _Alloc&>) { + return std::forward_as_tuple(std::forward<_Args>(__args)..., __alloc); + } else { + static_assert( + sizeof(_Type) + 1 == 0, "If uses_allocator_v<Type> is true, the type has to be allocator-constructible"); + } + } +}; template <class _Type, class _Alloc, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args) { return std::make_from_tuple<_Type>( - std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)); + __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...)); } template <class _Type, class _Alloc, class... _Args> @@ -212,7 +205,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Type* __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Args&&... __args) { return std::apply( [&__ptr](auto&&... __xs) { return std::__construct_at(__ptr, std::forward<decltype(__xs)>(__xs)...); }, - std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)); + __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...)); } #endif // _LIBCPP_STD_VER >= 17 @@ -221,8 +214,8 @@ __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _ template <class _Type, class _Alloc, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept - -> decltype(std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)) { - return /*--*/ std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...); + -> decltype(__uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...)) { + return /*--*/ __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...); } template <class _Type, class _Alloc, class... _Args> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h index a71096d3e47..fb36d5cad78 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -174,6 +174,19 @@ public: _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept { return __res_; } + _LIBCPP_HIDE_FROM_ABI friend bool + operator==(const polymorphic_allocator& __lhs, const polymorphic_allocator& __rhs) noexcept { + return *__lhs.resource() == *__rhs.resource(); + } + +# if _LIBCPP_STD_VER <= 17 + // This overload is not specified, it was added due to LWG3683. + _LIBCPP_HIDE_FROM_ABI friend bool + operator!=(const polymorphic_allocator& __lhs, const polymorphic_allocator& __rhs) noexcept { + return *__lhs.resource() != *__rhs.resource(); + } +# endif + private: template <class... _Args, size_t... _Is> _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...> diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex/lock_guard.h b/contrib/libs/cxxsupp/libcxx/include/__mutex/lock_guard.h index 8340b9bbd44..50765cdd047 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex/lock_guard.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex/lock_guard.h @@ -16,8 +16,6 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_HAS_NO_THREADS - _LIBCPP_BEGIN_NAMESPACE_STD template <class _Mutex> @@ -29,13 +27,13 @@ private: mutex_type& __m_; public: - _LIBCPP_NODISCARD + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) { __m_.lock(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} _LIBCPP_HIDE_FROM_ABI ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); } @@ -47,6 +45,4 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(lock_guard); _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_HAS_NO_THREADS - #endif // _LIBCPP___MUTEX_LOCK_GUARD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex/tag_types.h b/contrib/libs/cxxsupp/libcxx/include/__mutex/tag_types.h index 05ccb8b23a6..2b2dd58ee4e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex/tag_types.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex/tag_types.h @@ -15,8 +15,6 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_HAS_NO_THREADS - _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_EXPORTED_FROM_ABI defer_lock_t { @@ -31,18 +29,16 @@ struct _LIBCPP_EXPORTED_FROM_ABI adopt_lock_t { explicit adopt_lock_t() = default; }; -# if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 inline constexpr defer_lock_t defer_lock = defer_lock_t(); inline constexpr try_to_lock_t try_to_lock = try_to_lock_t(); inline constexpr adopt_lock_t adopt_lock = adopt_lock_t(); -# elif !defined(_LIBCPP_CXX03_LANG) +#elif !defined(_LIBCPP_CXX03_LANG) constexpr defer_lock_t defer_lock = defer_lock_t(); constexpr try_to_lock_t try_to_lock = try_to_lock_t(); constexpr adopt_lock_t adopt_lock = adopt_lock_t(); -# endif +#endif _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_HAS_NO_THREADS - #endif // _LIBCPP___MUTEX_TAG_TYPES_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex/unique_lock.h b/contrib/libs/cxxsupp/libcxx/include/__mutex/unique_lock.h index 4a616ba51ee..c404921070f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex/unique_lock.h +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex/unique_lock.h @@ -22,8 +22,6 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_HAS_NO_THREADS - _LIBCPP_BEGIN_NAMESPACE_STD template <class _Mutex> @@ -36,28 +34,28 @@ private: bool __owns_; public: - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI explicit unique_lock(mutex_type& __m) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI explicit unique_lock(mutex_type& __m) : __m_(std::addressof(__m)), __owns_(true) { __m_->lock(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT : __m_(std::addressof(__m)), __owns_(false) {} - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, try_to_lock_t) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, try_to_lock_t) : __m_(std::addressof(__m)), __owns_(__m.try_lock()) {} - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, adopt_lock_t) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, adopt_lock_t) : __m_(std::addressof(__m)), __owns_(true) {} template <class _Clock, class _Duration> - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) : __m_(std::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} template <class _Rep, class _Period> - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) : __m_(std::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} _LIBCPP_HIDE_FROM_ABI ~unique_lock() { @@ -68,7 +66,7 @@ public: unique_lock(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI unique_lock(unique_lock&& __u) _NOEXCEPT + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) { __u.__m_ = nullptr; @@ -86,16 +84,16 @@ public: return *this; } - void lock(); - bool try_lock(); + _LIBCPP_HIDE_FROM_ABI void lock(); + _LIBCPP_HIDE_FROM_ABI bool try_lock(); template <class _Rep, class _Period> - bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); + _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); template <class _Clock, class _Duration> - bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); + _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); - void unlock(); + _LIBCPP_HIDE_FROM_ABI void unlock(); _LIBCPP_HIDE_FROM_ABI void swap(unique_lock& __u) _NOEXCEPT { std::swap(__m_, __u.__m_); @@ -116,7 +114,7 @@ public: _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); template <class _Mutex> -void unique_lock<_Mutex>::lock() { +_LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); if (__owns_) @@ -126,7 +124,7 @@ void unique_lock<_Mutex>::lock() { } template <class _Mutex> -bool unique_lock<_Mutex>::try_lock() { +_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock() { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); if (__owns_) @@ -137,7 +135,7 @@ bool unique_lock<_Mutex>::try_lock() { template <class _Mutex> template <class _Rep, class _Period> -bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { +_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); if (__owns_) @@ -148,7 +146,7 @@ bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __ template <class _Mutex> template <class _Clock, class _Duration> -bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { +_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); if (__owns_) @@ -158,7 +156,7 @@ bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Durat } template <class _Mutex> -void unique_lock<_Mutex>::unlock() { +_LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::unlock() { if (!__owns_) __throw_system_error(EPERM, "unique_lock::unlock: not locked"); __m_->unlock(); @@ -172,6 +170,4 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(unique_lock<_Mutex>& __x, unique_lock<_Mu _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_HAS_NO_THREADS - #endif // _LIBCPP___MUTEX_UNIQUE_LOCK_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h b/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h index 4f7e9cfe1cf..3aadf6735e1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h @@ -10,29 +10,32 @@ #define _LIBCPP___OSTREAM_BASIC_OSTREAM_H #include <__config> -#include <__exception/operations.h> -#include <__memory/shared_ptr.h> -#include <__memory/unique_ptr.h> -#include <__system_error/error_code.h> -#include <__type_traits/conjunction.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_base_of.h> -#include <__type_traits/void_t.h> -#include <__utility/declval.h> -#include <bitset> -#include <cstddef> -#include <ios> -#include <locale> -#include <new> // for __throw_bad_alloc -#include <streambuf> -#include <string_view> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__exception/operations.h> +# include <__memory/shared_ptr.h> +# include <__memory/unique_ptr.h> +# include <__system_error/error_code.h> +# include <__type_traits/conjunction.h> +# include <__type_traits/enable_if.h> +# include <__type_traits/is_base_of.h> +# include <__type_traits/void_t.h> +# include <__utility/declval.h> +# include <bitset> +# include <cstddef> +# include <ios> +# include <locale> +# include <new> // for __throw_bad_alloc +# include <streambuf> +# include <string_view> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -99,19 +102,19 @@ public: basic_ostream& operator<<(long double __f); basic_ostream& operator<<(const void* __p); -#if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __p) { return operator<<(const_cast<const void*>(__p)); } -#endif +# endif basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb); -#if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 // LWG 2221 - nullptr. This is not backported to older standards modes. // See https://reviews.llvm.org/D127033 for more info on the rationale. _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; } -#endif +# endif // 27.7.2.7 Unformatted output: basic_ostream& put(char_type __c); @@ -152,16 +155,16 @@ basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& _ template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::sentry::~sentry() { - if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS + if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && uncaught_exceptions() == 0) { +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__os_.rdbuf()->pubsync() == -1) __os_.setstate(ios_base::badbit); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -182,15 +185,15 @@ basic_ostream<_CharT, _Traits>::~basic_ostream() {} template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { if (__sb) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _Op; _Ip __i(__sb); @@ -204,27 +207,27 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ } if (__c == 0) this->setstate(ios_base::failbit); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_failbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -232,19 +235,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; @@ -259,19 +262,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short .failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -279,19 +282,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; @@ -306,19 +309,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int _ .failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -326,19 +329,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -346,19 +349,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -366,19 +369,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -386,19 +389,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -406,19 +409,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -426,19 +429,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -446,19 +449,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(doubl if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -466,19 +469,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; @@ -486,20 +489,20 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Ip; @@ -513,11 +516,11 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s .failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -528,9 +531,9 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_ template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { _CharT __c = __os.widen(__cn); @@ -545,11 +548,11 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_ .failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -577,9 +580,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) { template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Ip; @@ -606,11 +609,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) { .failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -635,9 +638,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) { template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; @@ -646,37 +649,37 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __ if (__o.failed()) this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __sen(*this); if (__sen && __n) { if (this->rdbuf()->sputn(__s, __n) != __n) this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()) { sentry __s(*this); if (__s) { @@ -684,11 +687,11 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() { this->setstate(ios_base::badbit); } } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -797,9 +800,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) { std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } -#if 0 && _LIBCPP_STD_VER >= 20 +# if 0 && _LIBCPP_STD_VER >= 20 -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete; @@ -818,9 +821,9 @@ basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, co template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete; -# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -# ifndef _LIBCPP_HAS_NO_CHAR8_T +# ifndef _LIBCPP_HAS_NO_CHAR8_T template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete; @@ -832,7 +835,7 @@ basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const ch template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete; -# endif +# endif template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete; @@ -846,15 +849,17 @@ basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const ch template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete; -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; -#endif +# endif _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #endif // _LIBCPP___OSTREAM_BASIC_OSTREAM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ostream/print.h b/contrib/libs/cxxsupp/libcxx/include/__ostream/print.h index 8265ac00777..6c82b11e1de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ostream/print.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ostream/print.h @@ -10,21 +10,24 @@ #define _LIBCPP___OSTREAM_PRINT_H #include <__config> -#include <__fwd/ostream.h> -#include <__iterator/ostreambuf_iterator.h> -#include <__ostream/basic_ostream.h> -#include <format> -#include <ios> -#include <locale> -#include <print> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__fwd/ostream.h> +# include <__iterator/ostreambuf_iterator.h> +# include <__ostream/basic_ostream.h> +# include <format> +# include <ios> +# include <locale> +# include <print> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 23 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). _LIBCPP_HIDE_FROM_ABI inline void @@ -49,9 +52,9 @@ __vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool _ const char* __str = __o.data(); size_t __len = __o.size(); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef ostreambuf_iterator<char> _Ip; if (std::__pad_and_output( _Ip(__os), @@ -63,11 +66,11 @@ __vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool _ .failed()) __os.setstate(ios_base::badbit | ios_base::failbit); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -91,12 +94,12 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _ // is determined in the same way as the print(FILE*, ...) overloads. _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os); -# ifndef _LIBCPP_HAS_NO_UNICODE +# ifndef _LIBCPP_HAS_NO_UNICODE template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) { -# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 +# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0 return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); -# else +# else FILE* __file = std::__get_ostream_file(__os); if (!__file || !__print::__is_terminal(__file)) return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl); @@ -112,49 +115,49 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo // This is the path for the native API, start with flushing. __os.flush(); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS ostream::sentry __s(__os); if (__s) { -# ifndef _LIBCPP_WIN32API +# ifndef _LIBCPP_WIN32API __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true); -# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true); -# else -# error "Windows builds with wchar_t disabled are not supported." -# endif +# else +# error "Windows builds with wchar_t disabled are not supported." +# endif } -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS -# endif // _LIBCPP_AVAILABILITY_HAS_PRINT +# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_AVAILABILITY_HAS_PRINT } template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(ostream& __os, string_view __fmt, format_args __args) { std::__vprint_unicode(__os, __fmt, __args, false); } -# endif // _LIBCPP_HAS_NO_UNICODE +# endif // _LIBCPP_HAS_NO_UNICODE template <class... _Args> _LIBCPP_HIDE_FROM_ABI void print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { -# ifndef _LIBCPP_HAS_NO_UNICODE +# ifndef _LIBCPP_HAS_NO_UNICODE if constexpr (__print::__use_unicode_execution_charset) std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false); else std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false); -# else // _LIBCPP_HAS_NO_UNICODE +# else // _LIBCPP_HAS_NO_UNICODE std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false); -# endif // _LIBCPP_HAS_NO_UNICODE +# endif // _LIBCPP_HAS_NO_UNICODE } template <class... _Args> _LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) { -# ifndef _LIBCPP_HAS_NO_UNICODE +# ifndef _LIBCPP_HAS_NO_UNICODE // Note the wording in the Standard is inefficient. The output of // std::format is a std::string which is then copied. This solution // just appends a newline at the end of the output. @@ -162,9 +165,9 @@ _LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true); else std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true); -# else // _LIBCPP_HAS_NO_UNICODE +# else // _LIBCPP_HAS_NO_UNICODE std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true); -# endif // _LIBCPP_HAS_NO_UNICODE +# endif // _LIBCPP_HAS_NO_UNICODE } template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563). @@ -172,8 +175,10 @@ _LIBCPP_HIDE_FROM_ABI inline void println(ostream& __os) { std::print(__os, "\n"); } -#endif // _LIBCPP_STD_VER >= 23 +# endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #endif // _LIBCPP___OSTREAM_PRINT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backend.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backend.h index 86d9f28c77f..5980b0708cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backend.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backend.h @@ -19,16 +19,20 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if defined(_LIBCPP_PSTL_BACKEND_SERIAL) -# include <__pstl/backends/default.h> -# include <__pstl/backends/serial.h> -#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) -# include <__pstl/backends/default.h> -# include <__pstl/backends/std_thread.h> -#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH) -# include <__pstl/backends/default.h> -# include <__pstl/backends/libdispatch.h> -#endif +#if _LIBCPP_STD_VER >= 17 + +# if defined(_LIBCPP_PSTL_BACKEND_SERIAL) +# include <__pstl/backends/default.h> +# include <__pstl/backends/serial.h> +# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) +# include <__pstl/backends/default.h> +# include <__pstl/backends/std_thread.h> +# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH) +# include <__pstl/backends/default.h> +# include <__pstl/backends/libdispatch.h> +# endif + +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backend_fwd.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backend_fwd.h index 32c5da576fb..2132e8dbceb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backend_fwd.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backend_fwd.h @@ -39,6 +39,8 @@ _LIBCPP_PUSH_MACROS // the user. // +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -50,18 +52,18 @@ struct __libdispatch_backend_tag; struct __serial_backend_tag; struct __std_thread_backend_tag; -#if defined(_LIBCPP_PSTL_BACKEND_SERIAL) +# if defined(_LIBCPP_PSTL_BACKEND_SERIAL) using __current_configuration = __backend_configuration<__serial_backend_tag, __default_backend_tag>; -#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) +# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) using __current_configuration = __backend_configuration<__std_thread_backend_tag, __default_backend_tag>; -#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH) +# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH) using __current_configuration = __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>; -#else +# else // ...New vendors can add parallel backends here... -# error "Invalid PSTL backend configuration" -#endif +# error "Invalid PSTL backend configuration" +# endif template <class _Backend, class _ExecutionPolicy> struct __find_if; @@ -296,6 +298,8 @@ struct __reduce; } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_BACKEND_FWD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/default.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/default.h index 61a128805f8..3672bbf60a2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/default.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/default.h @@ -33,6 +33,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -163,7 +165,7 @@ struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> { [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool> operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept { using _FindIfNot = __dispatch<__find_if_not, __current_configuration, _ExecutionPolicy>; - auto __maybe_first = _FindIfNot()(__policy, std::move(__first), std::move(__last), __pred); + auto __maybe_first = _FindIfNot()(__policy, std::move(__first), __last, __pred); if (__maybe_first == nullopt) return nullopt; @@ -498,6 +500,8 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/libdispatch.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/libdispatch.h index a0c3ad980ed..2d6ab49c8f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/libdispatch.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/libdispatch.h @@ -44,6 +44,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -140,15 +142,15 @@ struct __cpu_traits<__libdispatch_backend_tag> { unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges( [&]() -> __merge_range_t* { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif return std::allocator<__merge_range_t>().allocate(__n_ranges); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (const std::bad_alloc&) { return nullptr; } -#endif +# endif }(), __destroy); @@ -392,6 +394,8 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy> } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/serial.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/serial.h index 5f24499899b..f4142016ccc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/serial.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/serial.h @@ -30,6 +30,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -176,6 +178,8 @@ struct __transform_reduce_binary<__serial_backend_tag, _ExecutionPolicy> { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/std_thread.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/std_thread.h index 49570bd30b0..19b985f860a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/std_thread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/backends/std_thread.h @@ -32,6 +32,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -131,6 +133,8 @@ struct __fill<__std_thread_backend_tag, _ExecutionPolicy> } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/any_of.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/any_of.h index b33c787a29d..803db7974ec 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/any_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/any_of.h @@ -26,6 +26,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -94,6 +96,8 @@ struct __cpu_parallel_any_of { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/cpu_traits.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/cpu_traits.h index 0483d6918fd..5e59752fa57 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/cpu_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/cpu_traits.h @@ -19,6 +19,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -81,6 +83,8 @@ struct __cpu_traits; } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/fill.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/fill.h index 4e6d29b30cc..3e5936589a6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/fill.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/fill.h @@ -23,6 +23,8 @@ # pragma GCC system_header #endif +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -63,4 +65,6 @@ struct __cpu_parallel_fill { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + #endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/find_if.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/find_if.h index 12b2e88971d..cd92e5a99f1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/find_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/find_if.h @@ -31,6 +31,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -132,6 +134,8 @@ struct __cpu_parallel_find_if { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/for_each.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/for_each.h index d4d7862135f..cec719bc47b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/for_each.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/for_each.h @@ -23,6 +23,8 @@ # pragma GCC system_header #endif +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -63,4 +65,6 @@ struct __cpu_parallel_for_each { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + #endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/merge.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/merge.h index dfa4cbf69b1..a9069ca51de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/merge.h @@ -26,6 +26,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -80,6 +82,8 @@ struct __cpu_parallel_merge { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/stable_sort.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/stable_sort.h index 8e64f3e537c..5afdd3fd629 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/stable_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/stable_sort.h @@ -21,6 +21,8 @@ # pragma GCC system_header #endif +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -44,4 +46,6 @@ struct __cpu_parallel_stable_sort { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + #endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform.h index 27ce8e27b24..979121be8c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform.h @@ -27,6 +27,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -148,6 +150,8 @@ struct __cpu_parallel_transform_binary { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform_reduce.h index 36ac1a9072a..aafbf1ca96b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform_reduce.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/cpu_algos/transform_reduce.h @@ -31,6 +31,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -211,6 +213,8 @@ struct __cpu_parallel_transform_reduce { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/dispatch.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/dispatch.h index 5e903f7524f..ea40fa79eb9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/dispatch.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/dispatch.h @@ -23,6 +23,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -61,6 +63,8 @@ using __dispatch = typename __find_first_implemented<_Algorithm, _BackendConfigu } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_DISPATCH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__pstl/handle_exception.h b/contrib/libs/cxxsupp/libcxx/include/__pstl/handle_exception.h index d6270958c3a..57dfcfde455 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__pstl/handle_exception.h +++ b/contrib/libs/cxxsupp/libcxx/include/__pstl/handle_exception.h @@ -22,6 +22,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_BEGIN_NAMESPACE_STD namespace __pstl { @@ -52,6 +54,8 @@ _LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) { } // namespace __pstl _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_POP_MACROS #endif // _LIBCPP___PSTL_HANDLE_EXCEPTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/binomial_distribution.h b/contrib/libs/cxxsupp/libcxx/include/__random/binomial_distribution.h index 54f321af63d..3f19746bae2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/binomial_distribution.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/binomial_distribution.h @@ -97,6 +97,11 @@ public: } }; +// The LLVM C library provides this with conflicting `noexcept` attributes. +#if !defined(_LIBCPP_MSVCRT_LIKE) && !defined(__LLVM_LIBC__) +extern "C" double lgamma_r(double, int*); +#endif + inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) { #if defined(_LIBCPP_MSVCRT_LIKE) return lgamma(__d); diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/mersenne_twister_engine.h b/contrib/libs/cxxsupp/libcxx/include/__random/mersenne_twister_engine.h index 65280d7c550..1f50e608ce8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/mersenne_twister_engine.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/mersenne_twister_engine.h @@ -13,6 +13,7 @@ #include <__algorithm/min.h> #include <__config> #include <__random/is_seed_sequence.h> +#include <__type_traits/enable_if.h> #include <cstddef> #include <cstdint> #include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h index 5cf84aeb8a7..c1a320a75c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h @@ -14,6 +14,8 @@ #include <__algorithm/max.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_unsigned.h> #include <cstdint> #include <initializer_list> diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/subtract_with_carry_engine.h b/contrib/libs/cxxsupp/libcxx/include/__random/subtract_with_carry_engine.h index ec25fed49f9..926333cdda4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/subtract_with_carry_engine.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/subtract_with_carry_engine.h @@ -14,6 +14,7 @@ #include <__config> #include <__random/is_seed_sequence.h> #include <__random/linear_congruential_engine.h> +#include <__type_traits/enable_if.h> #include <cstddef> #include <cstdint> #include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/uniform_random_bit_generator.h b/contrib/libs/cxxsupp/libcxx/include/__random/uniform_random_bit_generator.h index 4076f19b2cb..75ffc27f9fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/uniform_random_bit_generator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/uniform_random_bit_generator.h @@ -13,8 +13,8 @@ #include <__concepts/invocable.h> #include <__concepts/same_as.h> #include <__config> -#include <__functional/invoke.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/invoke.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h index f159f53dc0a..ac0d8dbbd52 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/elements_view.h @@ -16,7 +16,7 @@ #include <__concepts/derived_from.h> #include <__concepts/equality_comparable.h> #include <__config> -#include <__fwd/complex.h> +#include <__fwd/get.h> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__ranges/access.h> @@ -38,6 +38,7 @@ #include <__utility/forward.h> #include <__utility/move.h> #include <cstddef> +#include <tuple> // std::get #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h index c0f5ed936a6..b2fa958a0f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/iota_view.h @@ -344,6 +344,8 @@ public: return __iterator{__bound_sentinel_}; } + _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __value_ == __bound_sentinel_; } + _LIBCPP_HIDE_FROM_ABI constexpr auto size() const requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) || (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h index 2da246f24e1..b20165319bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/range_adaptor.h @@ -19,8 +19,10 @@ #include <__functional/invoke.h> #include <__ranges/concepts.h> #include <__type_traits/decay.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_class.h> #include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/remove_cv.h> #include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h index f91c7c35263..45244f34994 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/single_view.h @@ -70,6 +70,8 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* end() const noexcept { return data() + 1; } + _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return false; } + _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 1; } _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data() noexcept { return __value_.operator->(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h index aba584ef933..144746babb3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h @@ -33,6 +33,7 @@ #include <__tuple/tuple_size.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_pointer.h> #include <__type_traits/is_reference.h> #include <__type_traits/make_unsigned.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h index dc3aaa59ed8..42e9a131f73 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h @@ -34,6 +34,7 @@ #include <__ranges/view_interface.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/is_object.h> #include <__type_traits/is_reference.h> @@ -173,7 +174,8 @@ template <input_range _View, copy_constructible _Fn> # endif requires __transform_view_constraints<_View, _Fn> template <bool _Const> -class transform_view<_View, _Fn>::__iterator : public __transform_view_iterator_category_base<_View, _Fn> { +class transform_view<_View, _Fn>::__iterator + : public __transform_view_iterator_category_base<_View, __maybe_const<_Const, _Fn>> { using _Parent = __maybe_const<_Const, transform_view>; using _Base = __maybe_const<_Const, _View>; @@ -190,7 +192,7 @@ public: iterator_t<_Base> __current_ = iterator_t<_Base>(); using iterator_concept = typename __transform_view_iterator_concept<_View>::type; - using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>; + using value_type = remove_cvref_t<invoke_result_t<__maybe_const<_Const, _Fn>&, range_reference_t<_Base>>>; using difference_type = range_difference_t<_Base>; _LIBCPP_HIDE_FROM_ABI __iterator() @@ -326,13 +328,6 @@ public: { return __x.__current_ - __y.__current_; } - - _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(*__i)) { - if constexpr (is_lvalue_reference_v<decltype(*__i)>) - return std::move(*__i); - else - return *__i; - } }; # if _LIBCPP_STD_VER >= 23 diff --git a/contrib/libs/cxxsupp/libcxx/include/__split_buffer b/contrib/libs/cxxsupp/libcxx/include/__split_buffer index 2725b7d4365..5da7a1f74ab 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__split_buffer +++ b/contrib/libs/cxxsupp/libcxx/include/__split_buffer @@ -78,7 +78,7 @@ public: pointer __first_; pointer __begin_; pointer __end_; - __compressed_pair<pointer, allocator_type> __end_cap_; + _LIBCPP_COMPRESSED_PAIR(pointer, __end_cap_, allocator_type, __alloc_); using __alloc_ref = __add_lvalue_reference_t<allocator_type>; using __alloc_const_ref = __add_lvalue_reference_t<allocator_type>; @@ -88,13 +88,13 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag()) {} + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr) {} _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(__alloc_rr& __a) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) {} + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr), __alloc_(__a) {} _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(const __alloc_rr& __a) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) {} + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr), __alloc_(__a) {} _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); @@ -111,15 +111,11 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer(); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc() _NOEXCEPT { return __end_cap_.second(); } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc() const _NOEXCEPT { - return __end_cap_.second(); - } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc() _NOEXCEPT { return __alloc_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc() const _NOEXCEPT { return __alloc_; } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT { return __end_cap_.first(); } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT { - return __end_cap_.first(); - } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT { return __end_cap_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT { return __end_cap_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __begin_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __begin_; } @@ -351,7 +347,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) - : __end_cap_(nullptr, __a) { + : __end_cap_(nullptr), __alloc_(__a) { if (__cap == 0) { __first_ = nullptr; } else { @@ -376,7 +372,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__ : __first_(std::move(__c.__first_)), __begin_(std::move(__c.__begin_)), __end_(std::move(__c.__end_)), - __end_cap_(std::move(__c.__end_cap_)) { + __end_cap_(std::move(__c.__end_cap_)), + __alloc_(std::move(__c.__alloc_)) { __c.__first_ = nullptr; __c.__begin_ = nullptr; __c.__end_ = nullptr; @@ -386,7 +383,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__ template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) - : __end_cap_(nullptr, __a) { + : __end_cap_(nullptr), __alloc_(__a) { if (__a == __c.__alloc()) { __first_ = __c.__first_; __begin_ = __c.__begin_; diff --git a/contrib/libs/cxxsupp/libcxx/include/__std_clang_module b/contrib/libs/cxxsupp/libcxx/include/__std_clang_module index 18d6ce6b46c..a21ed26addf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__std_clang_module +++ b/contrib/libs/cxxsupp/libcxx/include/__std_clang_module @@ -33,9 +33,7 @@ #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) # include <atomic> #endif -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <barrier> -#endif +#include <barrier> #include <bit> #include <bitset> #include <cassert> @@ -75,12 +73,8 @@ #include <ctime> #include <ctype.h> #include <cuchar> -#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# include <cwchar> -#endif -#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# include <cwctype> -#endif +#include <cwchar> +#include <cwctype> #include <deque> #include <errno.h> #include <exception> @@ -101,9 +95,7 @@ # include <fstream> #endif #include <functional> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <future> -#endif +#include <future> #include <initializer_list> #include <inttypes.h> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) @@ -120,9 +112,7 @@ # include <istream> #endif #include <iterator> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <latch> -#endif +#include <latch> #include <limits> #include <list> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) @@ -153,13 +143,9 @@ # include <regex> #endif #include <scoped_allocator> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <semaphore> -#endif +#include <semaphore> #include <set> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <shared_mutex> -#endif +#include <shared_mutex> #include <source_location> #include <span> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) @@ -175,9 +161,7 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <stop_token> -#endif +#include <stop_token> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include <streambuf> #endif @@ -192,9 +176,7 @@ #endif #include <system_error> #include <tgmath.h> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <thread> -#endif +#include <thread> #include <tuple> #include <type_traits> #include <typeindex> @@ -207,9 +189,5 @@ #include <variant> #include <vector> #include <version> -#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# include <wchar.h> -#endif -#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# include <wctype.h> -#endif +#include <wchar.h> +#include <wctype.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__stop_token/atomic_unique_lock.h b/contrib/libs/cxxsupp/libcxx/include/__stop_token/atomic_unique_lock.h index 13e59f9f0dc..8fb70a4bfb5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__stop_token/atomic_unique_lock.h +++ b/contrib/libs/cxxsupp/libcxx/include/__stop_token/atomic_unique_lock.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H -#define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H +#ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H +#define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H #include <__bit/popcount.h> #include <__config> @@ -133,8 +133,8 @@ private: _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; }; }; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H +#endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_callback.h b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_callback.h index 760cf2bb55b..8d7167a5f03 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_callback.h +++ b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_callback.h @@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) template <class _Callback> class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base { @@ -93,10 +93,10 @@ private: template <class _Callback> _LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_source.h b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_source.h index 70697462784..7243856ecdd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_source.h +++ b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_source.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) struct nostopstate_t { explicit nostopstate_t() = default; @@ -84,8 +84,8 @@ private: __intrusive_shared_ptr<__stop_state> __state_; }; -#endif // _LIBCPP_STD_VER >= 20 +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP___STOP_TOKEN_STOP_SOURCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_token.h b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_token.h index 1bd75cbbf6f..b2569738896 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_token.h +++ b/contrib/libs/cxxsupp/libcxx/include/__stop_token/stop_token.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) class _LIBCPP_AVAILABILITY_SYNC stop_token { public: @@ -56,7 +56,7 @@ private: _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {} }; -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h index 44b46ebb94e..39accc69284 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h @@ -20,6 +20,7 @@ #include <__functional/hash.h> #include <__functional/identity.h> #include <__iterator/iterator_traits.h> +#include <__std_mbstate_t.h> #include <__string/constexpr_c_functions.h> #include <__type_traits/is_constant_evaluated.h> #include <__utility/is_pointer_in_range.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/constexpr_c_functions.h b/contrib/libs/cxxsupp/libcxx/include/__string/constexpr_c_functions.h index a978f816f18..9b8871e2e71 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string/constexpr_c_functions.h +++ b/contrib/libs/cxxsupp/libcxx/include/__string/constexpr_c_functions.h @@ -13,11 +13,13 @@ #include <__memory/addressof.h> #include <__memory/construct_at.h> #include <__type_traits/datasizeof.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_always_bitcastable.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_equality_comparable.h> +#include <__type_traits/is_integral.h> #include <__type_traits/is_same.h> #include <__type_traits/is_trivially_copyable.h> #include <__type_traits/is_trivially_lexicographically_comparable.h> @@ -64,13 +66,13 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_st return __builtin_strlen(reinterpret_cast<const char*>(__str)); } -// Because of __libcpp_is_trivially_lexicographically_comparable we know that comparing the object representations is +// Because of __is_trivially_lexicographically_comparable_v we know that comparing the object representations is // equivalent to a std::memcmp. Since we have multiple objects contiguously in memory, we can call memcmp once instead // of invoking it on every object individually. template <class _Tp, class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __constexpr_memcmp(const _Tp* __lhs, const _Up* __rhs, __element_count __n) { - static_assert(__libcpp_is_trivially_lexicographically_comparable<_Tp, _Up>::value, + static_assert(__is_trivially_lexicographically_comparable_v<_Tp, _Up>, "_Tp and _Up have to be trivially lexicographically comparable"); auto __count = static_cast<size_t>(__n); diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h index b9ffcbe1622..5aaf3eaa644 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h +++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h @@ -15,13 +15,13 @@ // Patch over lack of extended locale support typedef void* locale_t; -inline _LIBCPP_HIDE_FROM_ABI locale_t duplocale(locale_t) { return NULL; } +inline _LIBCPP_HIDE_FROM_ABI locale_t duplocale(locale_t) { return nullptr; } inline _LIBCPP_HIDE_FROM_ABI void freelocale(locale_t) {} -inline _LIBCPP_HIDE_FROM_ABI locale_t newlocale(int, const char*, locale_t) { return NULL; } +inline _LIBCPP_HIDE_FROM_ABI locale_t newlocale(int, const char*, locale_t) { return nullptr; } -inline _LIBCPP_HIDE_FROM_ABI locale_t uselocale(locale_t) { return NULL; } +inline _LIBCPP_HIDE_FROM_ABI locale_t uselocale(locale_t) { return nullptr; } #define LC_COLLATE_MASK (1 << LC_COLLATE) #define LC_CTYPE_MASK (1 << LC_CTYPE) diff --git a/contrib/libs/cxxsupp/libcxx/include/__system_error/system_error.h b/contrib/libs/cxxsupp/libcxx/include/__system_error/system_error.h index 362e6750565..3ffa1029ca5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__system_error/system_error.h +++ b/contrib/libs/cxxsupp/libcxx/include/__system_error/system_error.h @@ -39,8 +39,8 @@ public: _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; } }; -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg); -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) { +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg); +[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw system_error(__ec, __what_arg); #else diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h index b3d5c25fb71..9f3d41d3913 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/jthread.h @@ -11,17 +11,19 @@ #define _LIBCPP___THREAD_JTHREAD_H #include <__config> -#include <__functional/invoke.h> #include <__stop_token/stop_source.h> #include <__stop_token/stop_token.h> +#include <__thread/id.h> #include <__thread/support.h> #include <__thread/thread.h> #include <__type_traits/decay.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> +#include <__utility/swap.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -30,7 +32,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_BEGIN_NAMESPACE_STD @@ -127,7 +129,7 @@ private: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h index de7eea282c8..c7521c90ed5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/this_thread.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___THREAD_THIS_THREAD_H #define _LIBCPP___THREAD_THIS_THREAD_H +#include <__chrono/duration.h> #include <__chrono/steady_clock.h> #include <__chrono/time_point.h> #include <__condition_variable/condition_variable.h> @@ -29,6 +30,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace this_thread { +#ifndef _LIBCPP_HAS_NO_THREADS + _LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns); template <class _Rep, class _Period> @@ -65,6 +68,8 @@ inline _LIBCPP_HIDE_FROM_ABI void sleep_until(const chrono::time_point<chrono::s inline _LIBCPP_HIDE_FROM_ABI void yield() _NOEXCEPT { __libcpp_thread_yield(); } +#endif // !_LIBCPP_HAS_NO_THREADS + } // namespace this_thread _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h b/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h index d2254a695f5..481a3f38b82 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h +++ b/contrib/libs/cxxsupp/libcxx/include/__thread/thread.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___THREAD_THREAD_H #define _LIBCPP___THREAD_THREAD_H +#include <__assert> #include <__condition_variable/condition_variable.h> #include <__config> #include <__exception/terminate.h> @@ -20,6 +21,7 @@ #include <__system_error/system_error.h> #include <__thread/id.h> #include <__thread/support.h> +#include <__type_traits/decay.h> #include <__utility/forward.h> #include <tuple> @@ -37,6 +39,8 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD +#if !defined(_LIBCPP_HAS_NO_THREADS) + template <class _Tp> class __thread_specific_ptr; class _LIBCPP_EXPORTED_FROM_ABI __thread_struct; @@ -117,7 +121,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public __unary_function<__thread } }; -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# ifndef _LIBCPP_HAS_NO_LOCALIZATION template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) { @@ -142,7 +146,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) { __sstr << __id.__id_; return __os << __sstr.str(); } -#endif // _LIBCPP_HAS_NO_LOCALIZATION +# endif // _LIBCPP_HAS_NO_LOCALIZATION class _LIBCPP_EXPORTED_FROM_ABI thread { __libcpp_thread_t __t_; @@ -155,13 +159,13 @@ public: typedef __libcpp_thread_t native_handle_type; _LIBCPP_HIDE_FROM_ABI thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} -#ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); -#else // _LIBCPP_CXX03_LANG +# else // _LIBCPP_CXX03_LANG template <class _Fp> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f); -#endif +# endif ~thread(); _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; } @@ -185,7 +189,7 @@ public: static unsigned hardware_concurrency() _NOEXCEPT; }; -#ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG template <class _TSp, class _Fp, class... _Args, size_t... _Indices> inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) { @@ -215,7 +219,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) { __throw_system_error(__ec, "thread constructor failed"); } -#else // _LIBCPP_CXX03_LANG +# else // _LIBCPP_CXX03_LANG template <class _Fp> struct __thread_invoke_pair { @@ -247,10 +251,12 @@ thread::thread(_Fp __f) { __throw_system_error(__ec, "thread constructor failed"); } -#endif // _LIBCPP_CXX03_LANG +# endif // _LIBCPP_CXX03_LANG inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); } +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/__tree b/contrib/libs/cxxsupp/libcxx/include/__tree index 1990fa602d3..f6ef21cdaa5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tree +++ b/contrib/libs/cxxsupp/libcxx/include/__tree @@ -13,7 +13,6 @@ #include <__algorithm/min.h> #include <__assert> #include <__config> -#include <__functional/invoke.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> @@ -25,6 +24,8 @@ #include <__memory/unique_ptr.h> #include <__type_traits/can_extract_key.h> #include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_const.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_nothrow_assignable.h> @@ -566,11 +567,18 @@ struct __tree_node_base_types { typedef __tree_end_node<__node_base_pointer> __end_node_type; typedef __rebind_pointer_t<_VoidPtr, __end_node_type> __end_node_pointer; -#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB) typedef __end_node_pointer __parent_pointer; -#else - typedef __conditional_t< is_pointer<__end_node_pointer>::value, __end_node_pointer, __node_base_pointer> - __parent_pointer; + +// TODO(LLVM 22): Remove this check +#ifndef _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB + static_assert(sizeof(__node_base_pointer) == sizeof(__end_node_pointer) && _LIBCPP_ALIGNOF(__node_base_pointer) == + _LIBCPP_ALIGNOF(__end_node_pointer), + "It looks like you are using std::__tree (an implementation detail for (multi)map/set) with a fancy " + "pointer type that thas a different representation depending on whether it points to a __tree base " + "pointer or a __tree node pointer (both of which are implementation details of the standard library). " + "This means that your ABI is being broken between LLVM 19 and LLVM 20. If you don't care about your " + "ABI being broken, define the _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB macro to silence this " + "diagnostic."); #endif private: @@ -605,12 +613,7 @@ public: typedef _Tp __node_value_type; typedef __rebind_pointer_t<_VoidPtr, __node_value_type> __node_value_type_pointer; typedef __rebind_pointer_t<_VoidPtr, const __node_value_type> __const_node_value_type_pointer; -#if defined(_LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB) typedef typename __base::__end_node_pointer __iter_pointer; -#else - typedef __conditional_t< is_pointer<__node_pointer>::value, typename __base::__end_node_pointer, __node_pointer> - __iter_pointer; -#endif private: static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const"); @@ -932,21 +935,21 @@ private: private: __iter_pointer __begin_node_; - __compressed_pair<__end_node_t, __node_allocator> __pair1_; - __compressed_pair<size_type, value_compare> __pair3_; + _LIBCPP_COMPRESSED_PAIR(__end_node_t, __end_node_, __node_allocator, __node_alloc_); + _LIBCPP_COMPRESSED_PAIR(size_type, __size_, value_compare, __value_comp_); public: _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() _NOEXCEPT { - return static_cast<__iter_pointer>(pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())); + return static_cast<__iter_pointer>(pointer_traits<__end_node_ptr>::pointer_to(__end_node_)); } _LIBCPP_HIDE_FROM_ABI __iter_pointer __end_node() const _NOEXCEPT { return static_cast<__iter_pointer>( - pointer_traits<__end_node_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))); + pointer_traits<__end_node_ptr>::pointer_to(const_cast<__end_node_t&>(__end_node_))); } - _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __pair1_.second(); } + _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; } private: - _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __pair1_.second(); } + _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; } _LIBCPP_HIDE_FROM_ABI __iter_pointer& __begin_node() _NOEXCEPT { return __begin_node_; } _LIBCPP_HIDE_FROM_ABI const __iter_pointer& __begin_node() const _NOEXCEPT { return __begin_node_; } @@ -954,12 +957,12 @@ public: _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); } private: - _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __pair3_.first(); } + _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; } public: - _LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __pair3_.first(); } - _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __pair3_.second(); } - _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __pair3_.second(); } + _LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __size_; } + _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; } + _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; } public: _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT { @@ -1324,21 +1327,19 @@ private: template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) _NOEXCEPT_( is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value) - : __pair3_(0, __comp) { + : __size_(0), __value_comp_(__comp) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) - : __begin_node_(__iter_pointer()), - __pair1_(__default_init_tag(), __node_allocator(__a)), - __pair3_(0, __default_init_tag()) { + : __begin_node_(__iter_pointer()), __node_alloc_(__node_allocator(__a)), __size_(0) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a) - : __begin_node_(__iter_pointer()), __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, __comp) { + : __begin_node_(__iter_pointer()), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) { __begin_node() = __end_node(); } @@ -1437,8 +1438,9 @@ void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _ template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) : __begin_node_(__iter_pointer()), - __pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), - __pair3_(0, __t.value_comp()) { + __node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())), + __size_(0), + __value_comp_(__t.value_comp()) { __begin_node() = __end_node(); } @@ -1446,8 +1448,10 @@ template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value) : __begin_node_(std::move(__t.__begin_node_)), - __pair1_(std::move(__t.__pair1_)), - __pair3_(std::move(__t.__pair3_)) { + __end_node_(std::move(__t.__end_node_)), + __node_alloc_(std::move(__t.__node_alloc_)), + __size_(__t.__size_), + __value_comp_(std::move(__t.__value_comp_)) { if (size() == 0) __begin_node() = __end_node(); else { @@ -1460,7 +1464,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_( template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) - : __pair1_(__default_init_tag(), __node_allocator(__a)), __pair3_(0, std::move(__t.value_comp())) { + : __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(std::move(__t.value_comp())) { if (__a == __t.__alloc()) { if (__t.size() == 0) __begin_node() = __end_node(); @@ -1482,10 +1486,11 @@ template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) { destroy(static_cast<__node_pointer>(__end_node()->__left_)); - __begin_node_ = __t.__begin_node_; - __pair1_.first() = __t.__pair1_.first(); + __begin_node_ = __t.__begin_node_; + __end_node_ = __t.__end_node_; __move_assign_alloc(__t); - __pair3_ = std::move(__t.__pair3_); + __size_ = __t.__size_; + __value_comp_ = std::move(__t.__value_comp_); if (size() == 0) __begin_node() = __end_node(); else { @@ -1554,9 +1559,10 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) { using std::swap; swap(__begin_node_, __t.__begin_node_); - swap(__pair1_.first(), __t.__pair1_.first()); + swap(__end_node_, __t.__end_node_); std::__swap_allocator(__node_alloc(), __t.__node_alloc()); - __pair3_.swap(__t.__pair3_); + swap(__size_, __t.__size_); + swap(__value_comp_, __t.__value_comp_); if (size() == 0) __begin_node() = __end_node(); else diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/find_index.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/find_index.h index 133b00419d0..cc7329d3e89 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/find_index.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/find_index.h @@ -10,8 +10,8 @@ #define _LIBCPP___TUPLE_FIND_INDEX_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/is_same.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/ignore.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/ignore.h new file mode 100644 index 00000000000..43cce538741 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/ignore.h @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// 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___TUPLE_IGNORE_H +#define _LIBCPP___TUPLE_IGNORE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#ifndef _LIBCPP_CXX03_LANG + +_LIBCPP_BEGIN_NAMESPACE_STD + +struct __ignore_type { + template <class _Tp> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const __ignore_type& operator=(const _Tp&) const noexcept { + return *this; + } +}; + +# if _LIBCPP_STD_VER >= 17 +inline constexpr __ignore_type ignore; +# else +constexpr __ignore_type ignore; +# endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_CXX03_LANG + +#endif // _LIBCPP___TUPLE_IGNORE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/make_tuple_types.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/make_tuple_types.h index 9e0fefae2f2..53e98c3d6e9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/make_tuple_types.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/make_tuple_types.h @@ -10,6 +10,7 @@ #define _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/array.h> #include <__fwd/tuple.h> #include <__tuple/tuple_element.h> @@ -19,7 +20,6 @@ #include <__type_traits/copy_cvref.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_reference.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h index 7db5eeb1dd5..4a6ff1fd2df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/sfinae_helpers.h @@ -10,6 +10,7 @@ #define _LIBCPP___TUPLE_SFINAE_HELPERS_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/tuple.h> #include <__tuple/make_tuple_types.h> #include <__tuple/tuple_element.h> @@ -23,7 +24,6 @@ #include <__type_traits/is_same.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_element.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_element.h index 55b3b47619f..1404460e743 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_element.h @@ -10,9 +10,9 @@ #define _LIBCPP___TUPLE_TUPLE_ELEMENT_H #include <__config> +#include <__cstddef/size_t.h> #include <__tuple/tuple_indices.h> #include <__tuple/tuple_types.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -40,32 +40,6 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> { #ifndef _LIBCPP_CXX03_LANG -# if !__has_builtin(__type_pack_element) - -namespace __indexer_detail { - -template <size_t _Idx, class _Tp> -struct __indexed { - using type _LIBCPP_NODEBUG = _Tp; -}; - -template <class _Types, class _Indexes> -struct __indexer; - -template <class... _Types, size_t... _Idx> -struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {}; - -template <size_t _Idx, class _Tp> -__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); - -} // namespace __indexer_detail - -template <size_t _Idx, class... _Types> -using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>( - __indexer_detail::__indexer< __tuple_types<_Types...>, - typename __make_tuple_indices<sizeof...(_Types)>::type >{}))::type; -# endif - template <size_t _Ip, class... _Types> struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > { static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_indices.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_indices.h index 501e711255e..25dc9ec6859 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_indices.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_indices.h @@ -10,8 +10,8 @@ #define _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H #include <__config> +#include <__cstddef/size_t.h> #include <__utility/integer_sequence.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_ext.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_ext.h index 0cc21e0b75f..45c0e65d62f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_ext.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_ext.h @@ -10,12 +10,12 @@ #define _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/array.h> #include <__fwd/pair.h> #include <__fwd/tuple.h> #include <__tuple/tuple_types.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_no_subrange.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_no_subrange.h index 274b0bf188e..30018d6a05a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_no_subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_like_no_subrange.h @@ -10,13 +10,13 @@ #define _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/array.h> #include <__fwd/complex.h> #include <__fwd/pair.h> #include <__fwd/tuple.h> #include <__tuple/tuple_size.h> #include <__type_traits/remove_cvref.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_size.h b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_size.h index 18a17fd4d58..b970280fe37 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_size.h +++ b/contrib/libs/cxxsupp/libcxx/include/__tuple/tuple_size.h @@ -10,11 +10,13 @@ #define _LIBCPP___TUPLE_TUPLE_SIZE_H #include <__config> +#include <__cstddef/size_t.h> #include <__fwd/tuple.h> #include <__tuple/tuple_types.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_const.h> #include <__type_traits/is_volatile.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h index 358e3cbd238..5aac7d5cfa9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h @@ -11,9 +11,7 @@ #include <__config> #include <__type_traits/is_referenceable.h> -#include <__type_traits/is_same.h> #include <__type_traits/is_void.h> -#include <__type_traits/remove_cv.h> #include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_storage.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_storage.h index 46aae12832f..49b4e971bbb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_storage.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_storage.h @@ -10,11 +10,11 @@ #define _LIBCPP___TYPE_TRAITS_ALIGNED_STORAGE_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/conditional.h> #include <__type_traits/integral_constant.h> #include <__type_traits/nat.h> #include <__type_traits/type_list.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_union.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_union.h index 005ed9a096e..de62a4b1c2a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_union.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/aligned_union.h @@ -10,9 +10,9 @@ #define _LIBCPP___TYPE_TRAITS_ALIGNED_UNION_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/aligned_storage.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h index f2d069bf248..8871c8ce110 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h @@ -10,8 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h index b4cbd1ddfa8..0c1ed94f840 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/datasizeof.h @@ -10,9 +10,9 @@ #define _LIBCPP___TYPE_TRAITS_DATASIZEOF_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/is_class.h> #include <__type_traits/is_final.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -37,15 +37,15 @@ struct _FirstPaddingByte { char __first_padding_byte_; }; -// _FirstPaddingByte<> is sometimes non-standard layout. Using `offsetof` is UB in that case, but GCC and Clang allow -// the use as an extension. +// _FirstPaddingByte<> is sometimes non-standard layout. +// It is conditionally-supported to use __builtin_offsetof in that case, but GCC and Clang allow it. _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof") _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Winvalid-offsetof") template <class _Tp> -inline const size_t __datasizeof_v = offsetof(_FirstPaddingByte<_Tp>, __first_padding_byte_); +inline const size_t __datasizeof_v = __builtin_offsetof(_FirstPaddingByte<_Tp>, __first_padding_byte_); _LIBCPP_DIAGNOSTIC_POP -#endif // __has_extension(datasizeof) +#endif // __has_extension(datasizeof) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/desugars_to.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/desugars_to.h index 97a2ee5448f..b0ce7c414e5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/desugars_to.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/desugars_to.h @@ -17,10 +17,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// Tags to represent the canonical operations +// Tags to represent the canonical operations. + +// syntactically, the operation is equivalent to calling `a == b` struct __equal_tag {}; + +// syntactically, the operation is equivalent to calling `a + b` struct __plus_tag {}; -struct __less_tag {}; + +// syntactically, the operation is equivalent to calling `a < b`, and these expressions +// have to be true for any `a` and `b`: +// - `(a < b) == (b > a)` +// - `(!(a < b) && !(b < a)) == (a == b)` +// For example, this is satisfied for std::less on integral types, but also for ranges::less on all types due to +// additional semantic requirements on that operation. +struct __totally_ordered_less_tag {}; // This class template is used to determine whether an operation "desugars" // (or boils down) to a given canonical operation. diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h index 8f281b36f70..9d52032c0a4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h @@ -10,8 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_EXTENT_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h index a0281f5b200..71db32ae6a3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/invoke.h @@ -17,8 +17,7 @@ #include <__type_traits/integral_constant.h> #include <__type_traits/is_base_of.h> #include <__type_traits/is_core_convertible.h> -#include <__type_traits/is_member_function_pointer.h> -#include <__type_traits/is_member_object_pointer.h> +#include <__type_traits/is_member_pointer.h> #include <__type_traits/is_reference_wrapper.h> #include <__type_traits/is_same.h> #include <__type_traits/is_void.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_allocator.h index 144ffac4d7c..191eeb9a1f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_allocator.h @@ -10,10 +10,10 @@ #define _LIBCPP___TYPE_IS_ALLOCATOR_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> #include <__type_traits/void_t.h> #include <__utility/declval.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h index dc23de28d2c..f34204e19ed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h @@ -10,8 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_IS_ARRAY_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_of.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_of.h index 090abeeb54d..488b63719eb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_of.h @@ -26,6 +26,18 @@ template <class _Bp, class _Dp> inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); #endif +#if _LIBCPP_STD_VER >= 26 +# if __has_builtin(__builtin_is_virtual_base_of) + +template <class _Base, class _Derived> +struct _LIBCPP_TEMPLATE_VIS is_virtual_base_of : public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> {}; + +template <class _Base, class _Derived> +inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); + +# endif +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_BASE_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h index 211403d638d..a78b52e7062 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h @@ -10,8 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h index 77ca3ea1087..2fab6db2c8d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h @@ -26,6 +26,16 @@ template <class _Tp> inline constexpr bool is_enum_v = __is_enum(_Tp); #endif +#if _LIBCPP_STD_VER >= 23 + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {}; + +template <class _Tp> +inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); + +#endif // _LIBCPP_STD_VER >= 23 + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_ENUM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h index 580d1b6b7db..98fedd0ad96 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h @@ -11,8 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_const.h> -#include <__type_traits/is_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,22 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_function) && !defined(__CUDACC__) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant<bool, __is_function(_Tp)> {}; -#else - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_function - : public integral_constant<bool, !(is_reference<_Tp>::value || is_const<const _Tp>::value)> {}; - -#endif // __has_builtin(__is_function) - #if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_function_v = is_function<_Tp>::value; +inline constexpr bool is_function_v = __is_function(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h index 417739f9dc8..a1211bca4fe 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h @@ -34,7 +34,7 @@ inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental - : public integral_constant<bool, is_void<_Tp>::value || __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; + : public integral_constant<bool, is_void<_Tp>::value || __is_null_pointer_v<_Tp> || is_arithmetic<_Tp>::value> {}; # if _LIBCPP_STD_VER >= 17 template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h deleted file mode 100644 index af2c3e2d83b..00000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H -#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H - -#include <__config> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_function.h> -#include <__type_traits/remove_cv.h> -#include <cstddef> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -struct __libcpp_is_member_pointer { - enum { __is_member = false, __is_func = false, __is_obj = false }; -}; -template <class _Tp, class _Up> -struct __libcpp_is_member_pointer<_Tp _Up::*> { - enum { - __is_member = true, - __is_func = is_function<_Tp>::value, - __is_obj = !__is_func, - }; -}; - -#if __has_builtin(__is_member_function_pointer) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); -# endif - -#else // __has_builtin(__is_member_function_pointer) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer - : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func> {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; -# endif - -#endif // __has_builtin(__is_member_function_pointer) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h deleted file mode 100644 index 645488edebe..00000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___TYPE_TRAITS_IS_MEMBER_OBJECT_POINTER_H -#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_OBJECT_POINTER_H - -#include <__config> -#include <__type_traits/integral_constant.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if __has_builtin(__is_member_object_pointer) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); -# endif - -#else // __has_builtin(__is_member_object_pointer) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer - : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj> {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; -# endif - -#endif // __has_builtin(__is_member_object_pointer) - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h index 429f2affcb4..3e2753ac422 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_member_function_pointer.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,28 +18,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_member_pointer) && !defined(__CUDACC__) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {}; -# if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); -# endif +struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {}; -#else // __has_builtin(__is_member_pointer) +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {}; +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_pointer - : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member> {}; +inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); -# if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; -# endif +inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); -#endif // __has_builtin(__is_member_pointer) +template <class _Tp> +inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); +#endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h index 678debb455e..58d2b247514 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h @@ -13,10 +13,6 @@ #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_constructible.h> -#include <__type_traits/is_reference.h> -#include <__utility/declval.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,85 +20,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 -#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC) && !defined(__CUDACC__) - template < class _Tp, class... _Args> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {}; -#else - -template <bool, bool, class _Tp, class... _Args> -struct __libcpp_is_nothrow_constructible; - -template <class _Tp, class... _Args> -struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ false, _Tp, _Args...> - : public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> {}; - -template <class _Tp> -void __implicit_conversion_to(_Tp) noexcept {} - -template <class _Tp, class _Arg> -struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ true, _Tp, _Arg> - : public integral_constant<bool, noexcept(std::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> {}; - -template <class _Tp, bool _IsReference, class... _Args> -struct __libcpp_is_nothrow_constructible</*is constructible*/ false, _IsReference, _Tp, _Args...> : public false_type { -}; - -template <class _Tp, class... _Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible - : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, - is_reference<_Tp>::value, - _Tp, - _Args...> {}; - -template <class _Tp, size_t _Ns> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> - : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> {}; - -#endif // __has_builtin(__is_nothrow_constructible) #if _LIBCPP_STD_VER >= 17 template <class _Tp, class... _Args> inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; #endif -// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed -#ifdef _LIBCPP_COMPILER_GCC - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible - : public is_nothrow_constructible<_Tp, __add_lvalue_reference_t<const _Tp> > {}; - -#else // _LIBCPP_COMPILER_GCC - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible : public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {}; -#endif // _LIBCPP_COMPILER_GCC - #if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; #endif -// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed -#ifndef _LIBCPP_COMPILER_GCC - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible : public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {}; -#else // _LIBCPP_COMPILER_GCC - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible - : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {}; - -#endif // _LIBCPP_COMPILER_GCC - #if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h index c2d5ca87232..41271a38f37 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h @@ -10,10 +10,10 @@ #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_destructible.h> #include <__utility/declval.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h index c666f5f2475..302b2f89033 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h @@ -10,9 +10,9 @@ #define _LIBCPP___TYPE_TRAITS_IS_NULL_POINTER_H #include <__config> +#include <__cstddef/nullptr_t.h> #include <__type_traits/integral_constant.h> #include <__type_traits/remove_cv.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,20 +21,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -struct __is_nullptr_t_impl : public false_type {}; -template <> -struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; +#if __has_builtin(__remove_cv) +inline const bool __is_null_pointer_v = __is_same(__remove_cv(_Tp), nullptr_t); +#else +inline const bool __is_null_pointer_v = __is_same(__remove_cv_t<_Tp>, nullptr_t); +#endif #if _LIBCPP_STD_VER >= 14 template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_null_pointer : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; +struct _LIBCPP_TEMPLATE_VIS is_null_pointer : integral_constant<bool, __is_null_pointer_v<_Tp>> {}; # if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; +inline constexpr bool is_null_pointer_v = __is_null_pointer_v<_Tp>; # endif #endif // _LIBCPP_STD_VER >= 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h index cdfe4838e6e..ec04508402c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h @@ -11,10 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_array.h> -#include <__type_traits/is_class.h> -#include <__type_traits/is_scalar.h> -#include <__type_traits/is_union.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,30 +18,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_object) && !defined(__CUDACC__) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> {}; -# if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_object_v = __is_object(_Tp); -# endif - -#else // __has_builtin(__is_object) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_object - : public integral_constant<bool, - is_scalar<_Tp>::value || is_array<_Tp>::value || is_union<_Tp>::value || - is_class<_Tp>::value > {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_object_v = is_object<_Tp>::value; -# endif - -#endif // __has_builtin(__is_object) +#endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h index 9d8564679b5..cc157a438e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h @@ -18,28 +18,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) && __has_builtin(__is_reference) && \ - !defined(__CUDACC__) +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {}; +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {}; +inline constexpr bool is_reference_v = __is_reference(_Tp); +#endif + +#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {}; template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_reference_v = __is_reference(_Tp); -template <class _Tp> inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); template <class _Tp> inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); # endif -#else // __has_builtin(__is_lvalue_reference) && etc... +#else // __has_builtin(__is_lvalue_reference) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; @@ -51,25 +53,15 @@ struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; - # if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_reference_v = is_reference<_Tp>::value; - -template <class _Tp> inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; template <class _Tp> inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; # endif -#endif // __has_builtin(__is_lvalue_reference) && etc... +#endif // __has_builtin(__is_lvalue_reference) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h index e6f8e87f184..09117928a91 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h @@ -49,7 +49,7 @@ struct _LIBCPP_TEMPLATE_VIS is_scalar bool, is_arithmetic<_Tp>::value || is_member_pointer<_Tp>::value || is_pointer<_Tp>::value || - __is_nullptr_t<_Tp>::value || + __is_null_pointer_v<_Tp> || __is_block<_Tp>::value || is_enum<_Tp>::value> {}; // clang-format on diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scoped_enum.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scoped_enum.h deleted file mode 100644 index 1db88e13356..00000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scoped_enum.h +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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___TYPE_TRAITS_IS_SCOPED_ENUM_H -#define _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H - -#include <__config> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_convertible.h> -#include <__type_traits/is_enum.h> -#include <__type_traits/underlying_type.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 23 - -// TODO: GCC and Clang both have this builtin. Remove the false case once we've updated to GCC 14. -# if __has_builtin(__is_scoped_enum) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {}; - -template <class _Tp> -inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); - -# else - -template <class _Tp, bool = is_enum_v<_Tp> > -struct __is_scoped_enum_helper : false_type {}; - -template <class _Tp> -struct __is_scoped_enum_helper<_Tp, true> : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {}; - -template <class _Tp> -inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; - -# endif // __has_builtin(__is_scoped_enum) - -#endif // _LIBCPP_STD_VER >= 23 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_swappable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_swappable.h index 0b817e65099..221f017700a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_swappable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_swappable.h @@ -10,15 +10,16 @@ #define _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_nothrow_assignable.h> #include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/void_t.h> #include <__utility/declval.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h index a310ea1b87e..15dda5824a3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h @@ -10,6 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_LEXICOGRAPHICALLY_COMPARABLE_H #include <__config> +#include <__fwd/byte.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_same.h> #include <__type_traits/is_unsigned.h> @@ -40,13 +41,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD // unsigned integer types with sizeof(T) > 1: depending on the endianness, the LSB might be the first byte to be // compared. This means that when comparing unsigned(129) and unsigned(2) // using memcmp(), the result would be that 2 > 129. -// TODO: Do we want to enable this on big-endian systems? + +template <class _Tp> +inline const bool __is_std_byte_v = false; + +#if _LIBCPP_STD_VER >= 17 +template <> +inline const bool __is_std_byte_v<byte> = true; +#endif template <class _Tp, class _Up> -struct __libcpp_is_trivially_lexicographically_comparable - : integral_constant<bool, - is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value && sizeof(_Tp) == 1 && - is_unsigned<_Tp>::value> {}; +inline const bool __is_trivially_lexicographically_comparable_v = + is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value && +#ifdef _LIBCPP_LITTLE_ENDIAN + sizeof(_Tp) == 1 && +#endif + (is_unsigned<_Tp>::value || __is_std_byte_v<_Tp>); _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h index 69eea76488f..813bf45dc06 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_same.h> #include <__type_traits/remove_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -20,27 +19,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__is_void) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> {}; - -# if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr bool is_void_v = __is_void(_Tp); -# endif - +#if __has_builtin(__remove_cv) +struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_same(__remove_cv(_Tp), void)> {}; #else +struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_same(__remove_cv_t<_Tp>, void)> {}; +#endif +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_void : public is_same<__remove_cv_t<_Tp>, void> {}; - -# if _LIBCPP_STD_VER >= 17 -template <class _Tp> -inline constexpr bool is_void_v = is_void<_Tp>::value; -# endif - -#endif // __has_builtin(__is_void) +# if __has_builtin(__remove_cv) +inline constexpr bool is_void_v = __is_same(__remove_cv(_Tp), void); +# else +inline constexpr bool is_void_v = __is_same(__remove_cv_t<_Tp>, void); +# endif +#endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_signed.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_signed.h index c1fc009d9ba..d09d6ed4a1e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_signed.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_signed.h @@ -10,6 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_MAKE_SIGNED_H #include <__config> +#include <__type_traits/copy_cv.h> #include <__type_traits/is_enum.h> #include <__type_traits/is_integral.h> #include <__type_traits/nat.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_unsigned.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_unsigned.h index 282cd2d9113..8757f451eb8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_unsigned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/make_unsigned.h @@ -86,12 +86,10 @@ template <class _Tp> using make_unsigned_t = __make_unsigned_t<_Tp>; #endif -#ifndef _LIBCPP_CXX03_LANG template <class _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr __make_unsigned_t<_Tp> __to_unsigned_like(_Tp __x) noexcept { +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __make_unsigned_t<_Tp> __to_unsigned_like(_Tp __x) _NOEXCEPT { return static_cast<__make_unsigned_t<_Tp> >(__x); } -#endif template <class _Tp, class _Up> using __copy_unsigned_t = __conditional_t<is_unsigned<_Tp>::value, __make_unsigned_t<_Up>, _Up>; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h index 7f6fad1c540..aeeedec40de 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h @@ -10,8 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_RANK_H #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/integral_constant.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h index d5373b51f52..db7dab4a6c1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h @@ -10,7 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_REMOVE_ALL_EXTENTS_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h index 639a9c4fb63..e09cfd77230 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h @@ -34,7 +34,7 @@ using __remove_cv_t = typename remove_cv<_Tp>::type; #else template <class _Tp> using __remove_cv_t = __remove_cv(_Tp); -#endif // __has_builtin(__remove_cv) +#endif #if _LIBCPP_STD_VER >= 14 template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h index fe37b5c7266..aceeb470696 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h @@ -10,7 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/result_of.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/result_of.h index f00fa8e9be7..73a19447520 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/result_of.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/result_of.h @@ -10,7 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_RESULT_OF_H #include <__config> -#include <__functional/invoke.h> +#include <__type_traits/invoke.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_list.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_list.h index 02905707ee3..0d9ca989583 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_list.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_list.h @@ -10,7 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_TYPE_LIST_H #include <__config> -#include <cstddef> +#include <__cstddef/size_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h index d5275dcbd0e..66740664470 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h @@ -21,13 +21,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT { return static_cast<_Tp&&>(__t); } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT { static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); return static_cast<_Tp&&>(__t); diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h index fa7a2f4bfd4..459b2716752 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h @@ -10,6 +10,7 @@ #define _LIBCPP___UTILITY_IN_PLACE_H #include <__config> +#include <__type_traits/integral_constant.h> #include <__type_traits/remove_cvref.h> #include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h index b6a42db0545..66aec5aa26d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h @@ -26,7 +26,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&& +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&& move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up; return static_cast<_Up&&>(__t); @@ -37,7 +37,7 @@ using __move_if_noexcept_result_t = __conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>; template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp> move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT { return std::move(__x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h index 0afbebcdc9f..78534a3f399 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h @@ -25,6 +25,7 @@ #include <__type_traits/common_type.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h index ee8657196d9..a8caf5bdeaf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h @@ -20,22 +20,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace rel_ops { template <class _Tp> -inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const _Tp& __x, const _Tp& __y) { +inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } template <class _Tp> -inline _LIBCPP_HIDE_FROM_ABI bool operator>(const _Tp& __x, const _Tp& __y) { +inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator>(const _Tp& __x, const _Tp& __y) { return __y < __x; } template <class _Tp> -inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const _Tp& __x, const _Tp& __y) { +inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } template <class _Tp> -inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const _Tp& __x, const _Tp& __y) { +inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h index ab88b8e0a0b..ecfbdec75a2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h @@ -10,6 +10,7 @@ #define _LIBCPP___UTILITY_SWAP_H #include <__config> +#include <__type_traits/enable_if.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_nothrow_assignable.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h index d833f74c2e4..5525452aa55 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { +[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { _LIBCPP_ASSERT_INTERNAL(false, "std::unreachable() was reached"); __builtin_unreachable(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__verbose_abort b/contrib/libs/cxxsupp/libcxx/include/__verbose_abort index 195ce65b721..244278aec65 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__verbose_abort +++ b/contrib/libs/cxxsupp/libcxx/include/__verbose_abort @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // This function should never be called directly from the code -- it should only be called through // the _LIBCPP_VERBOSE_ABORT macro. -_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS +[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...); // _LIBCPP_VERBOSE_ABORT(format, args...) diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index a522a60f1b5..36fd035b7e5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -102,6 +102,31 @@ namespace ranges { constexpr borrowed_iterator_t<R> find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr subrange<I> find_last(I first, S last, const T& value, Proj proj = {}); // since C++23 + + template<forward_range R, class T, class Proj = identity> + requires + indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> + constexpr borrowed_subrange_t<R> find_last(R&& r, const T& value, Proj proj = {}); // since C++23 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr subrange<I> find_last_if(I first, S last, Pred pred, Proj proj = {}); // since C++23 + + template<forward_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr borrowed_subrange_t<R> find_last_if(R&& r, Pred pred, Proj proj = {}); // since C++23 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr subrange<I> find_last_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++23 + + template<forward_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr borrowed_subrange_t<R> find_last_if_not(R&& r, Pred pred, Proj proj = {}); // since C++23 + template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 @@ -288,6 +313,9 @@ namespace ranges { template<class I, class F> using for_each_result = in_fun_result<I, F>; // since C++20 + template<class I, class F> + using for_each_n_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> @@ -675,6 +703,12 @@ namespace ranges { ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + template<class I, class O> + using move_result = in_out_result<I, O>; // since C++20 + + template<class I, class O> + using move_backward_result = in_out_result<I, O>; // since C++20 + template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> requires indirectly_movable<I1, I2> constexpr ranges::move_backward_result<I1, I2> @@ -1989,6 +2023,7 @@ template <class BidirectionalIterator, class Compare> # include <__algorithm/fold.h> # include <__algorithm/ranges_contains_subrange.h> # include <__algorithm/ranges_ends_with.h> +# include <__algorithm/ranges_find_last.h> # include <__algorithm/ranges_starts_with.h> #endif // _LIBCPP_STD_VER >= 23 diff --git a/contrib/libs/cxxsupp/libcxx/include/any b/contrib/libs/cxxsupp/libcxx/include/any index 5def14dc87e..6e4ff31ff9b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/any +++ b/contrib/libs/cxxsupp/libcxx/include/any @@ -90,6 +90,7 @@ namespace std { #include <__type_traits/aligned_storage.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_function.h> #include <__type_traits/is_nothrow_constructible.h> @@ -126,7 +127,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 17 -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() { +[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_any_cast(); # else diff --git a/contrib/libs/cxxsupp/libcxx/include/array b/contrib/libs/cxxsupp/libcxx/include/array index 6ffde852f48..0e9af419863 100644 --- a/contrib/libs/cxxsupp/libcxx/include/array +++ b/contrib/libs/cxxsupp/libcxx/include/array @@ -19,17 +19,17 @@ template <class T, size_t N > struct array { // types: - typedef T & reference; - typedef const T & const_reference; - typedef implementation defined iterator; - typedef implementation defined const_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + using value_type = T; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using size_type = size_t; + using difference_type = ptrdiff_t; + using iterator = implementation-defined; + using const_iterator = implementation-defined; + using reverse_iterator = std::reverse_iterator<iterator>; + using const_reverse_iterator = std::reverse_iterator<const_iterator>; // No explicit construct/copy/destroy for aggregate type void fill(const T& u); // constexpr in C++20 @@ -124,6 +124,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #include <__tuple/sfinae_helpers.h> #include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_array.h> #include <__type_traits/is_const.h> #include <__type_traits/is_constructible.h> @@ -232,7 +233,7 @@ struct _LIBCPP_TEMPLATE_VIS array { // capacity: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return _Size == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return _Size == 0; } // element access: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT { @@ -270,20 +271,25 @@ struct _LIBCPP_TEMPLATE_VIS array { template <class _Tp> struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> { // types: - typedef array __self; - typedef _Tp value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - - typedef __conditional_t<is_const<_Tp>::value, const __empty, __empty> _EmptyType; + using __self = array; + using value_type = _Tp; + using reference = value_type&; + using const_reference = const value_type&; + using pointer = value_type*; + using const_pointer = const value_type*; +#if defined(_LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY) + using iterator = __wrap_iter<pointer>; + using const_iterator = __wrap_iter<const_pointer>; +#else + using iterator = pointer; + using const_iterator = const_pointer; +#endif + using size_type = size_t; + using difference_type = ptrdiff_t; + using reverse_iterator = std::reverse_iterator<iterator>; + using const_reverse_iterator = std::reverse_iterator<const_iterator>; + + using _EmptyType = __conditional_t<is_const<_Tp>::value, const __empty, __empty>; struct _ArrayInStructT { _Tp __data_[1]; @@ -335,7 +341,7 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> { // capacity: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return 0; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return 0; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return true; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return true; } // element access: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT { @@ -422,8 +428,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const array<_Tp, _Size>& __x, const template <class _Tp, size_t _Size> _LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp> operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 @@ -440,7 +445,7 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> > : public integral_con template <size_t _Ip, class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > { static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)"); - typedef _Tp type; + using type = _Tp; }; template <size_t _Ip, class _Tp, size_t _Size> diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic index 80a0f9ee373..bf65750672b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/atomic +++ b/contrib/libs/cxxsupp/libcxx/include/atomic @@ -101,12 +101,12 @@ struct atomic bool compare_exchange_strong(T& expc, T desr, memory_order m = memory_order_seq_cst) noexcept; - void wait(T, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(T, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(T, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(T, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template <> @@ -184,12 +184,12 @@ struct atomic<integral> integral operator^=(integral op) volatile noexcept; integral operator^=(integral op) noexcept; - void wait(integral, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(integral, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(integral, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(integral, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template <class T> @@ -254,12 +254,12 @@ struct atomic<T*> T* operator-=(ptrdiff_t op) volatile noexcept; T* operator-=(ptrdiff_t op) noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(T*, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; template<> @@ -321,12 +321,12 @@ struct atomic<floating-point-type> { // since C++20 floating-point-type operator-=(floating-point-type) volatile noexcept; floating-point-type operator-=(floating-point-type) noexcept; - void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 }; // [atomics.nonmembers], non-member functions @@ -443,23 +443,23 @@ template<class T> memory_order) noexcept; template<class T> - void atomic_wait(const volatile atomic<T>*, atomic<T>::value_type) noexcept; + void atomic_wait(const volatile atomic<T>*, atomic<T>::value_type) noexcept; // since C++20 template<class T> - void atomic_wait(const atomic<T>*, atomic<T>::value_type) noexcept; + void atomic_wait(const atomic<T>*, atomic<T>::value_type) noexcept; // since C++20 template<class T> - void atomic_wait_explicit(const volatile atomic<T>*, atomic<T>::value_type, + void atomic_wait_explicit(const volatile atomic<T>*, atomic<T>::value_type, // since C++20 memory_order) noexcept; template<class T> - void atomic_wait_explicit(const atomic<T>*, atomic<T>::value_type, + void atomic_wait_explicit(const atomic<T>*, atomic<T>::value_type, // since C++20 memory_order) noexcept; template<class T> - void atomic_notify_one(volatile atomic<T>*) noexcept; + void atomic_notify_one(volatile atomic<T>*) noexcept; // since C++20 template<class T> - void atomic_notify_one(atomic<T>*) noexcept; + void atomic_notify_one(atomic<T>*) noexcept; // since C++20 template<class T> - void atomic_notify_all(volatile atomic<T>*) noexcept; + void atomic_notify_all(volatile atomic<T>*) noexcept; // since C++20 template<class T> - void atomic_notify_all(atomic<T>*) noexcept; + void atomic_notify_all(atomic<T>*) noexcept; // since C++20 // Atomics for standard typedef types @@ -534,12 +534,12 @@ typedef struct atomic_flag void clear(memory_order m = memory_order_seq_cst) volatile noexcept; void clear(memory_order m = memory_order_seq_cst) noexcept; - void wait(bool, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(bool, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; + void wait(bool, memory_order = memory_order::seq_cst) const volatile noexcept; // since C++20 + void wait(bool, memory_order = memory_order::seq_cst) const noexcept; // since C++20 + void notify_one() volatile noexcept; // since C++20 + void notify_one() noexcept; // since C++20 + void notify_all() volatile noexcept; // since C++20 + void notify_all() noexcept; // since C++20 } atomic_flag; bool atomic_flag_test(volatile atomic_flag* obj) noexcept; @@ -557,14 +557,14 @@ void atomic_flag_clear(atomic_flag* obj) noexcept; void atomic_flag_clear_explicit(volatile atomic_flag* obj, memory_order m) noexcept; void atomic_flag_clear_explicit(atomic_flag* obj, memory_order m) noexcept; -void atomic_wait(const volatile atomic_flag* obj, T old) noexcept; -void atomic_wait(const atomic_flag* obj, T old) noexcept; -void atomic_wait_explicit(const volatile atomic_flag* obj, T old, memory_order m) noexcept; -void atomic_wait_explicit(const atomic_flag* obj, T old, memory_order m) noexcept; -void atomic_one(volatile atomic_flag* obj) noexcept; -void atomic_one(atomic_flag* obj) noexcept; -void atomic_all(volatile atomic_flag* obj) noexcept; -void atomic_all(atomic_flag* obj) noexcept; +void atomic_wait(const volatile atomic_flag* obj, T old) noexcept; // since C++20 +void atomic_wait(const atomic_flag* obj, T old) noexcept; // since C++20 +void atomic_wait_explicit(const volatile atomic_flag* obj, T old, memory_order m) noexcept; // since C++20 +void atomic_wait_explicit(const atomic_flag* obj, T old, memory_order m) noexcept; // since C++20 +void atomic_one(volatile atomic_flag* obj) noexcept; // since C++20 +void atomic_one(atomic_flag* obj) noexcept; // since C++20 +void atomic_all(volatile atomic_flag* obj) noexcept; // since C++20 +void atomic_all(atomic_flag* obj) noexcept; // since C++20 // fences @@ -589,17 +589,12 @@ template <class T> #include <__config> -#if _LIBCPP_STD_VER < 23 && defined(_LIBCPP_STDATOMIC_H) -# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. -#endif - #include <__atomic/aliases.h> #include <__atomic/atomic.h> #include <__atomic/atomic_base.h> #include <__atomic/atomic_flag.h> #include <__atomic/atomic_init.h> #include <__atomic/atomic_lock_free.h> -#include <__atomic/atomic_ref.h> #include <__atomic/atomic_sync.h> #include <__atomic/check_memory_order.h> #include <__atomic/contention_t.h> @@ -610,6 +605,10 @@ template <class T> #include <__atomic/memory_order.h> #include <version> +#if _LIBCPP_STD_VER >= 20 +# include <__atomic/atomic_ref.h> +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/barrier b/contrib/libs/cxxsupp/libcxx/include/barrier index 12608e17d8f..abc014e8aaf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/barrier +++ b/contrib/libs/cxxsupp/libcxx/include/barrier @@ -17,7 +17,7 @@ namespace std { template<class CompletionFunction = see below> - class barrier + class barrier // since C++20 { public: using arrival_token = see below; @@ -47,30 +47,28 @@ namespace std #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<barrier> is not supported since libc++ has been configured without support for threads." -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) -#include <__assert> -#include <__atomic/atomic_base.h> -#include <__atomic/memory_order.h> -#include <__memory/unique_ptr.h> -#include <__thread/poll_with_backoff.h> -#include <__thread/timed_backoff_policy.h> -#include <__utility/move.h> -#include <cstddef> -#include <cstdint> -#include <limits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# include <__assert> +# include <__atomic/atomic_base.h> +# include <__atomic/memory_order.h> +# include <__memory/unique_ptr.h> +# include <__thread/poll_with_backoff.h> +# include <__thread/timed_backoff_policy.h> +# include <__utility/move.h> +# include <cstddef> +# include <cstdint> +# include <limits> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> -#if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -78,7 +76,7 @@ struct __empty_completion { inline _LIBCPP_HIDE_FROM_ABI void operator()() noexcept {} }; -# ifndef _LIBCPP_HAS_NO_TREE_BARRIER +# ifndef _LIBCPP_HAS_NO_TREE_BARRIER /* @@ -127,7 +125,7 @@ public: __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0) {} - _LIBCPP_NODISCARD _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) { + [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) { _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __update <= __expected_, "update is greater than the expected count for the current barrier phase"); @@ -152,7 +150,7 @@ public: } }; -# else +# else /* @@ -253,10 +251,10 @@ public: } }; -# endif // !_LIBCPP_HAS_NO_TREE_BARRIER +# endif // !_LIBCPP_HAS_NO_TREE_BARRIER template <class _CompletionF = __empty_completion> -class _LIBCPP_DEPRECATED_ATOMIC_SYNC barrier { +class barrier { __barrier_base<_CompletionF> __b_; public: @@ -265,7 +263,7 @@ public: static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); } _LIBCPP_AVAILABILITY_SYNC - _LIBCPP_HIDE_FROM_ABI explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()) + _LIBCPP_HIDE_FROM_ABI explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()) : __b_(__count, std::move(__completion)) { _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN( __count >= 0, @@ -279,7 +277,7 @@ public: barrier(barrier const&) = delete; barrier& operator=(barrier const&) = delete; - _LIBCPP_NODISCARD _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) { + [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) { _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update > 0, "barrier:arrive must be called with a value greater than 0"); return __b_.arrive(__update); } @@ -292,10 +290,12 @@ public: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> @@ -305,4 +305,4 @@ _LIBCPP_POP_MACROS # include <variant> #endif -#endif //_LIBCPP_BARRIER +#endif // _LIBCPP_BARRIER diff --git a/contrib/libs/cxxsupp/libcxx/include/bitset b/contrib/libs/cxxsupp/libcxx/include/bitset index 6bd7bfe585f..ce23d522168 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bitset +++ b/contrib/libs/cxxsupp/libcxx/include/bitset @@ -128,6 +128,7 @@ template <size_t N> struct hash<std::bitset<N>>; #include <__algorithm/count.h> #include <__algorithm/fill.h> +#include <__algorithm/fill_n.h> #include <__algorithm/find.h> #include <__bit_reference> #include <__config> diff --git a/contrib/libs/cxxsupp/libcxx/include/chrono b/contrib/libs/cxxsupp/libcxx/include/chrono index 23441ddb239..7bec5e5a26e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/chrono +++ b/contrib/libs/cxxsupp/libcxx/include/chrono @@ -789,6 +789,21 @@ strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // [time.zone.zonedtraits], class template zoned_traits template<class T> struct zoned_traits; // C++20 +// [time.zone.zonedtime], class template zoned_time +template<class Duration, class TimeZonePtr = const time_zone*> // C++20 +class zoned_time; + +using zoned_seconds = zoned_time<seconds>; // C++20 + +template<class Duration1, class Duration2, class TimeZonePtr> // C++20 + bool operator==(const zoned_time<Duration1, TimeZonePtr>& x, + const zoned_time<Duration2, TimeZonePtr>& y); + +template<class charT, class traits, class Duration, class TimeZonePtr> // C++20 + basic_ostream<charT, traits>& + operator<<(basic_ostream<charT, traits>& os, + const zoned_time<Duration, TimeZonePtr>& t); + // [time.zone.leap], leap second support class leap_second { // C++20 public: @@ -871,6 +886,8 @@ namespace std { struct formatter<chrono::hh_mm_ss<duration<Rep, Period>>, charT>; // C++20 template<class charT> struct formatter<chrono::sys_info, charT>; // C++20 template<class charT> struct formatter<chrono::local_info, charT>; // C++20 + template<class Duration, class TimeZonePtr, class charT> // C++20 + struct formatter<chrono::zoned_time<Duration, TimeZonePtr>, charT>; } // namespace std namespace chrono { @@ -998,8 +1015,8 @@ constexpr chrono::year operator ""y(unsigned lo # include <charconv> # if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include <locale> +# include <ostream> # endif -# include <ostream> #endif #endif // _LIBCPP_CHRONO diff --git a/contrib/libs/cxxsupp/libcxx/include/cmath b/contrib/libs/cxxsupp/libcxx/include/cmath index 7a87e35c846..5d30b151870 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cmath +++ b/contrib/libs/cxxsupp/libcxx/include/cmath @@ -204,6 +204,14 @@ floating_point fmin (arithmetic x, arithmetic y); float fminf(float x, float y); long double fminl(long double x, long double y); +double hermite(unsigned n, double x); // C++17 +float hermite(unsigned n, float x); // C++17 +long double hermite(unsigned n, long double x); // C++17 +float hermitef(unsigned n, float x); // C++17 +long double hermitel(unsigned n, long double x); // C++17 +template <class Integer> +double hermite(unsigned n, Integer x); // C++17 + floating_point hypot (arithmetic x, arithmetic y); float hypotf(float x, float y); long double hypotl(long double x, long double y); @@ -305,6 +313,7 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept */ #include <__config> +#include <__math/hypot.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_constant_evaluated.h> @@ -315,6 +324,7 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept #include <limits> #include <version> +#include <__math/special_functions.h> #include <math.h> #ifndef _LIBCPP_MATH_H @@ -544,44 +554,6 @@ using ::scalbnl _LIBCPP_USING_IF_EXISTS; using ::tgammal _LIBCPP_USING_IF_EXISTS; using ::truncl _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER >= 17 -inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} -inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} -inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} - -template <class _A1, class _A2, class _A3> -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, - __promote<_A1, _A2, _A3> >::type -hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT { - typedef typename __promote<_A1, _A2, _A3>::type __result_type; - static_assert( - !(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value && is_same<_A3, __result_type>::value), - ""); - return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); -} -#endif - -template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT { -#if __has_builtin(__builtin_isnan) - return __builtin_isnan(__lcpp_x); -#else - return isnan(__lcpp_x); -#endif -} - -template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT { - return std::isnan(__lcpp_x); -} - template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT { #if __has_builtin(__builtin_isinf) @@ -596,20 +568,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NO return std::isinf(__lcpp_x); } -template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT { -#if __has_builtin(__builtin_isfinite) - return __builtin_isfinite(__lcpp_x); -#else - return isfinite(__lcpp_x); -#endif -} - -template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT { - return __builtin_isfinite(__lcpp_x); -} - #if _LIBCPP_STD_VER >= 20 template <typename _Fp> _LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { diff --git a/contrib/libs/cxxsupp/libcxx/include/complex b/contrib/libs/cxxsupp/libcxx/include/complex index bfe61c506e1..80471d903f5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/complex +++ b/contrib/libs/cxxsupp/libcxx/include/complex @@ -421,7 +421,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex float __v) + template <class _Tag, __enable_if_t<_IsSame<_Tag, __from_builtin_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex float __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c); @@ -517,7 +518,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex double __v) + template <class _Tag, __enable_if_t<_IsSame<_Tag, __from_builtin_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex double __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c); @@ -617,7 +619,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex long double __v) + template <class _Tag, __enable_if_t<_IsSame<_Tag, __from_builtin_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex long double __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex<float>& __c); @@ -994,14 +997,14 @@ conj(_Tp __re) { template <class _Tp> inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> proj(const complex<_Tp>& __c) { complex<_Tp> __r = __c; - if (std::__constexpr_isinf(__c.real()) || std::__constexpr_isinf(__c.imag())) + if (std::isinf(__c.real()) || std::isinf(__c.imag())) __r = complex<_Tp>(INFINITY, std::copysign(_Tp(0), __c.imag())); return __r; } template <class _Tp, __enable_if_t<is_floating_point<_Tp>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_ComplexType proj(_Tp __re) { - if (std::__constexpr_isinf(__re)) + if (std::isinf(__re)) __re = std::abs(__re); return complex<_Tp>(__re); } @@ -1016,23 +1019,23 @@ inline _LIBCPP_HIDE_FROM_ABI typename __libcpp_complex_overload_traits<_Tp>::_Co template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) { - if (std::__constexpr_isnan(__rho) || std::signbit(__rho)) + if (std::isnan(__rho) || std::signbit(__rho)) return complex<_Tp>(_Tp(NAN), _Tp(NAN)); - if (std::__constexpr_isnan(__theta)) { - if (std::__constexpr_isinf(__rho)) + if (std::isnan(__theta)) { + if (std::isinf(__rho)) return complex<_Tp>(__rho, __theta); return complex<_Tp>(__theta, __theta); } - if (std::__constexpr_isinf(__theta)) { - if (std::__constexpr_isinf(__rho)) + if (std::isinf(__theta)) { + if (std::isinf(__rho)) return complex<_Tp>(__rho, _Tp(NAN)); return complex<_Tp>(_Tp(NAN), _Tp(NAN)); } _Tp __x = __rho * std::cos(__theta); - if (std::__constexpr_isnan(__x)) + if (std::isnan(__x)) __x = 0; _Tp __y = __rho * std::sin(__theta); - if (std::__constexpr_isnan(__y)) + if (std::isnan(__y)) __y = 0; return complex<_Tp>(__x, __y); } @@ -1055,14 +1058,12 @@ inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) { - if (std::__constexpr_isinf(__x.imag())) + if (std::isinf(__x.imag())) return complex<_Tp>(_Tp(INFINITY), __x.imag()); - if (std::__constexpr_isinf(__x.real())) { + if (std::isinf(__x.real())) { if (__x.real() > _Tp(0)) - return complex<_Tp>( - __x.real(), std::__constexpr_isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag())); - return complex<_Tp>( - std::__constexpr_isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag())); + return complex<_Tp>(__x.real(), std::isnan(__x.imag()) ? __x.imag() : std::copysign(_Tp(0), __x.imag())); + return complex<_Tp>(std::isnan(__x.imag()) ? __x.imag() : _Tp(0), std::copysign(__x.real(), __x.imag())); } return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2)); } @@ -1075,12 +1076,12 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) { if (__i == 0) { return complex<_Tp>(std::exp(__x.real()), std::copysign(_Tp(0), __x.imag())); } - if (std::__constexpr_isinf(__x.real())) { + if (std::isinf(__x.real())) { if (__x.real() < _Tp(0)) { - if (!std::__constexpr_isfinite(__i)) + if (!std::isfinite(__i)) __i = _Tp(1); - } else if (__i == 0 || !std::__constexpr_isfinite(__i)) { - if (std::__constexpr_isinf(__i)) + } else if (__i == 0 || !std::isfinite(__i)) { + if (std::isinf(__i)) __i = _Tp(NAN); return complex<_Tp>(__x.real(), __i); } @@ -1127,21 +1128,21 @@ inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> __sqr(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) { const _Tp __pi(atan2(+0., -0.)); - if (std::__constexpr_isinf(__x.real())) { - if (std::__constexpr_isnan(__x.imag())) + if (std::isinf(__x.real())) { + if (std::isnan(__x.imag())) return __x; - if (std::__constexpr_isinf(__x.imag())) + if (std::isinf(__x.imag())) return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag())); return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag())); } - if (std::__constexpr_isnan(__x.real())) { - if (std::__constexpr_isinf(__x.imag())) + if (std::isnan(__x.real())) { + if (std::isinf(__x.imag())) return complex<_Tp>(__x.imag(), __x.real()); if (__x.imag() == 0) return __x; return complex<_Tp>(__x.real(), __x.real()); } - if (std::__constexpr_isinf(__x.imag())) + if (std::isinf(__x.imag())) return complex<_Tp>(std::copysign(__x.imag(), __x.real()), std::copysign(__pi / _Tp(2), __x.imag())); complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) + _Tp(1))); return complex<_Tp>(std::copysign(__z.real(), __x.real()), std::copysign(__z.imag(), __x.imag())); @@ -1152,10 +1153,10 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> asinh(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) { const _Tp __pi(atan2(+0., -0.)); - if (std::__constexpr_isinf(__x.real())) { - if (std::__constexpr_isnan(__x.imag())) + if (std::isinf(__x.real())) { + if (std::isnan(__x.imag())) return complex<_Tp>(std::abs(__x.real()), __x.imag()); - if (std::__constexpr_isinf(__x.imag())) { + if (std::isinf(__x.imag())) { if (__x.real() > 0) return complex<_Tp>(__x.real(), std::copysign(__pi * _Tp(0.25), __x.imag())); else @@ -1165,12 +1166,12 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) { return complex<_Tp>(-__x.real(), std::copysign(__pi, __x.imag())); return complex<_Tp>(__x.real(), std::copysign(_Tp(0), __x.imag())); } - if (std::__constexpr_isnan(__x.real())) { - if (std::__constexpr_isinf(__x.imag())) + if (std::isnan(__x.real())) { + if (std::isinf(__x.imag())) return complex<_Tp>(std::abs(__x.imag()), __x.real()); return complex<_Tp>(__x.real(), __x.real()); } - if (std::__constexpr_isinf(__x.imag())) + if (std::isinf(__x.imag())) return complex<_Tp>(std::abs(__x.imag()), std::copysign(__pi / _Tp(2), __x.imag())); complex<_Tp> __z = std::log(__x + std::sqrt(std::__sqr(__x) - _Tp(1))); return complex<_Tp>(std::copysign(__z.real(), _Tp(0)), std::copysign(__z.imag(), __x.imag())); @@ -1181,18 +1182,18 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acosh(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) { const _Tp __pi(atan2(+0., -0.)); - if (std::__constexpr_isinf(__x.imag())) { + if (std::isinf(__x.imag())) { return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag())); } - if (std::__constexpr_isnan(__x.imag())) { - if (std::__constexpr_isinf(__x.real()) || __x.real() == 0) + if (std::isnan(__x.imag())) { + if (std::isinf(__x.real()) || __x.real() == 0) return complex<_Tp>(std::copysign(_Tp(0), __x.real()), __x.imag()); return complex<_Tp>(__x.imag(), __x.imag()); } - if (std::__constexpr_isnan(__x.real())) { + if (std::isnan(__x.real())) { return complex<_Tp>(__x.real(), __x.real()); } - if (std::__constexpr_isinf(__x.real())) { + if (std::isinf(__x.real())) { return complex<_Tp>(std::copysign(_Tp(0), __x.real()), std::copysign(__pi / _Tp(2), __x.imag())); } if (std::abs(__x.real()) == _Tp(1) && __x.imag() == _Tp(0)) { @@ -1206,11 +1207,11 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> atanh(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) { - if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag())) + if (std::isinf(__x.real()) && !std::isfinite(__x.imag())) return complex<_Tp>(__x.real(), _Tp(NAN)); - if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag())) + if (__x.real() == 0 && !std::isfinite(__x.imag())) return complex<_Tp>(__x.real(), _Tp(NAN)); - if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real())) + if (__x.imag() == 0 && !std::isfinite(__x.real())) return __x; return complex<_Tp>(std::sinh(__x.real()) * std::cos(__x.imag()), std::cosh(__x.real()) * std::sin(__x.imag())); } @@ -1219,13 +1220,13 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> sinh(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) { - if (std::__constexpr_isinf(__x.real()) && !std::__constexpr_isfinite(__x.imag())) + if (std::isinf(__x.real()) && !std::isfinite(__x.imag())) return complex<_Tp>(std::abs(__x.real()), _Tp(NAN)); - if (__x.real() == 0 && !std::__constexpr_isfinite(__x.imag())) + if (__x.real() == 0 && !std::isfinite(__x.imag())) return complex<_Tp>(_Tp(NAN), __x.real()); if (__x.real() == 0 && __x.imag() == 0) return complex<_Tp>(_Tp(1), __x.imag()); - if (__x.imag() == 0 && !std::__constexpr_isfinite(__x.real())) + if (__x.imag() == 0 && !std::isfinite(__x.real())) return complex<_Tp>(std::abs(__x.real()), __x.imag()); return complex<_Tp>(std::cosh(__x.real()) * std::cos(__x.imag()), std::sinh(__x.real()) * std::sin(__x.imag())); } @@ -1234,18 +1235,18 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> cosh(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> tanh(const complex<_Tp>& __x) { - if (std::__constexpr_isinf(__x.real())) { - if (!std::__constexpr_isfinite(__x.imag())) + if (std::isinf(__x.real())) { + if (!std::isfinite(__x.imag())) return complex<_Tp>(std::copysign(_Tp(1), __x.real()), _Tp(0)); return complex<_Tp>(std::copysign(_Tp(1), __x.real()), std::copysign(_Tp(0), std::sin(_Tp(2) * __x.imag()))); } - if (std::__constexpr_isnan(__x.real()) && __x.imag() == 0) + if (std::isnan(__x.real()) && __x.imag() == 0) return __x; _Tp __2r(_Tp(2) * __x.real()); _Tp __2i(_Tp(2) * __x.imag()); _Tp __d(std::cosh(__2r) + std::cos(__2i)); _Tp __2rsh(std::sinh(__2r)); - if (std::__constexpr_isinf(__2rsh) && std::__constexpr_isinf(__d)) + if (std::isinf(__2rsh) && std::isinf(__d)) return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1), __2i > _Tp(0) ? _Tp(0) : _Tp(-0.)); return complex<_Tp>(__2rsh / __d, std::sin(__2i) / __d); } @@ -1263,10 +1264,10 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> asin(const complex<_Tp>& __x) { template <class _Tp> _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) { const _Tp __pi(atan2(+0., -0.)); - if (std::__constexpr_isinf(__x.real())) { - if (std::__constexpr_isnan(__x.imag())) + if (std::isinf(__x.real())) { + if (std::isnan(__x.imag())) return complex<_Tp>(__x.imag(), __x.real()); - if (std::__constexpr_isinf(__x.imag())) { + if (std::isinf(__x.imag())) { if (__x.real() < _Tp(0)) return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag()); return complex<_Tp>(_Tp(0.25) * __pi, -__x.imag()); @@ -1275,12 +1276,12 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> acos(const complex<_Tp>& __x) { return complex<_Tp>(__pi, std::signbit(__x.imag()) ? -__x.real() : __x.real()); return complex<_Tp>(_Tp(0), std::signbit(__x.imag()) ? __x.real() : -__x.real()); } - if (std::__constexpr_isnan(__x.real())) { - if (std::__constexpr_isinf(__x.imag())) + if (std::isnan(__x.real())) { + if (std::isinf(__x.imag())) return complex<_Tp>(__x.real(), -__x.imag()); return complex<_Tp>(__x.real(), __x.real()); } - if (std::__constexpr_isinf(__x.imag())) + if (std::isinf(__x.imag())) return complex<_Tp>(__pi / _Tp(2), -__x.imag()); if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag()))) return complex<_Tp>(__pi / _Tp(2), -__x.imag()); diff --git a/contrib/libs/cxxsupp/libcxx/include/condition_variable b/contrib/libs/cxxsupp/libcxx/include/condition_variable index 5195cd6057d..229a2ce103b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/condition_variable +++ b/contrib/libs/cxxsupp/libcxx/include/condition_variable @@ -173,7 +173,7 @@ public: template <class _Lock, class _Rep, class _Period, class _Predicate> bool _LIBCPP_HIDE_FROM_ABI wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred); -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# if _LIBCPP_STD_VER >= 20 template <class _Lock, class _Predicate> _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait(_Lock& __lock, stop_token __stoken, _Predicate __pred); @@ -186,7 +186,7 @@ public: _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool wait_for(_Lock& __lock, stop_token __stoken, const chrono::duration<_Rep, _Period>& __rel_time, _Predicate __pred); -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# endif // _LIBCPP_STD_VER >= 20 }; inline condition_variable_any::condition_variable_any() : __mut_(make_shared<mutex>()) {} @@ -260,7 +260,7 @@ condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Pe return wait_until(__lock, chrono::steady_clock::now() + __d, std::move(__pred)); } -# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# if _LIBCPP_STD_VER >= 20 template <class _Lock, class _Predicate> bool condition_variable_any::wait(_Lock& __user_lock, stop_token __stoken, _Predicate __pred) { @@ -341,7 +341,7 @@ bool condition_variable_any::wait_for( return wait_until(__lock, std::move(__stoken), chrono::steady_clock::now() + __rel_time, std::move(__pred)); } -# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>); diff --git a/contrib/libs/cxxsupp/libcxx/include/cstddef b/contrib/libs/cxxsupp/libcxx/include/cstddef index 1a4049e4d34..2b138d96903 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstddef +++ b/contrib/libs/cxxsupp/libcxx/include/cstddef @@ -34,9 +34,6 @@ Types: */ #include <__config> -#include <__type_traits/enable_if.h> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_integral.h> #include <version> #include <stddef.h> @@ -53,81 +50,10 @@ Types: # pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -using ::nullptr_t; -using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS; -using ::size_t _LIBCPP_USING_IF_EXISTS; - -#if !defined(_LIBCPP_CXX03_LANG) -using ::max_align_t _LIBCPP_USING_IF_EXISTS; -#endif - -_LIBCPP_END_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 -namespace std // purposefully not versioned -{ -enum class byte : unsigned char {}; - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept { - return static_cast<byte>( - static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs))); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept { - return __lhs = __lhs | __rhs; -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept { - return static_cast<byte>( - static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs))); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept { - return __lhs = __lhs & __rhs; -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept { - return static_cast<byte>( - static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs))); -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept { - return __lhs = __lhs ^ __rhs; -} - -_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept { - return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b))); -} - -template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift) noexcept { - return __lhs = __lhs << __shift; -} - -template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept { - return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift)); -} - -template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift) noexcept { - return __lhs = __lhs >> __shift; -} - -template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept { - return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift)); -} - -template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Integer to_integer(byte __b) noexcept { - return static_cast<_Integer>(__b); -} - -} // namespace std - -#endif +#include <__cstddef/byte.h> +#include <__cstddef/max_align_t.h> +#include <__cstddef/nullptr_t.h> +#include <__cstddef/ptrdiff_t.h> +#include <__cstddef/size_t.h> #endif // _LIBCPP_CSTDDEF diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdio b/contrib/libs/cxxsupp/libcxx/include/cstdio index 7f94371081f..a461c24dcc0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdio +++ b/contrib/libs/cxxsupp/libcxx/include/cstdio @@ -96,6 +96,7 @@ void perror(const char* s); */ #include <__config> +#include <__cstddef/size_t.h> #include <stdio.h> @@ -115,7 +116,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD using ::FILE _LIBCPP_USING_IF_EXISTS; using ::fpos_t _LIBCPP_USING_IF_EXISTS; -using ::size_t _LIBCPP_USING_IF_EXISTS; using ::fclose _LIBCPP_USING_IF_EXISTS; using ::fflush _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/cstdlib b/contrib/libs/cxxsupp/libcxx/include/cstdlib index 25a829bb053..02ee3a25b98 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstdlib +++ b/contrib/libs/cxxsupp/libcxx/include/cstdlib @@ -82,6 +82,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 */ #include <__config> +#include <__cstddef/size_t.h> #include <stdlib.h> @@ -99,7 +100,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 _LIBCPP_BEGIN_NAMESPACE_STD -using ::size_t _LIBCPP_USING_IF_EXISTS; using ::div_t _LIBCPP_USING_IF_EXISTS; using ::ldiv_t _LIBCPP_USING_IF_EXISTS; using ::lldiv_t _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/cstring b/contrib/libs/cxxsupp/libcxx/include/cstring index c2c92b02e73..5bb6e3e1062 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstring +++ b/contrib/libs/cxxsupp/libcxx/include/cstring @@ -57,6 +57,7 @@ size_t strlen(const char* s); */ #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/is_constant_evaluated.h> #include <string.h> @@ -75,7 +76,6 @@ size_t strlen(const char* s); _LIBCPP_BEGIN_NAMESPACE_STD -using ::size_t _LIBCPP_USING_IF_EXISTS; using ::memcpy _LIBCPP_USING_IF_EXISTS; using ::memmove _LIBCPP_USING_IF_EXISTS; using ::strcpy _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/ctime b/contrib/libs/cxxsupp/libcxx/include/ctime index cad942e6109..2df861c0de1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ctime +++ b/contrib/libs/cxxsupp/libcxx/include/ctime @@ -46,6 +46,7 @@ int timespec_get( struct timespec *ts, int base); // C++17 */ #include <__config> +#include <__cstddef/size_t.h> // <time.h> is not provided by libc++ #if __has_include(<time.h>) @@ -62,7 +63,6 @@ int timespec_get( struct timespec *ts, int base); // C++17 _LIBCPP_BEGIN_NAMESPACE_STD using ::clock_t _LIBCPP_USING_IF_EXISTS; -using ::size_t _LIBCPP_USING_IF_EXISTS; using ::time_t _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; #if _LIBCPP_STD_VER >= 17 && __has_attribute(using_if_exists) diff --git a/contrib/libs/cxxsupp/libcxx/include/cuchar b/contrib/libs/cxxsupp/libcxx/include/cuchar index f0015be2753..bfc26f03aaf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cuchar +++ b/contrib/libs/cxxsupp/libcxx/include/cuchar @@ -37,6 +37,7 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); */ #include <__config> +#include <__cstddef/size_t.h> #include <uchar.h> @@ -57,7 +58,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_CXX03_LANG) using ::mbstate_t _LIBCPP_USING_IF_EXISTS; -using ::size_t _LIBCPP_USING_IF_EXISTS; # if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8) using ::mbrtoc8 _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/cwchar b/contrib/libs/cxxsupp/libcxx/include/cwchar index 08cfac58c84..f5a26664c1c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cwchar +++ b/contrib/libs/cxxsupp/libcxx/include/cwchar @@ -103,6 +103,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, */ #include <__config> +#include <__cstddef/size_t.h> #include <__type_traits/copy_cv.h> #include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_equality_comparable.h> @@ -127,7 +128,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, _LIBCPP_BEGIN_NAMESPACE_STD using ::mbstate_t _LIBCPP_USING_IF_EXISTS; -using ::size_t _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; using ::wint_t _LIBCPP_USING_IF_EXISTS; using ::FILE _LIBCPP_USING_IF_EXISTS; diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index fc0e1adfc13..f6c748a4bfc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -184,7 +184,10 @@ template <class T, class Allocator, class Predicate> #include <__algorithm/fill_n.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> +#include <__algorithm/max.h> #include <__algorithm/min.h> +#include <__algorithm/move.h> +#include <__algorithm/move_backward.h> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> #include <__algorithm/unwrap_iter.h> @@ -195,13 +198,18 @@ template <class T, class Allocator, class Predicate> #include <__fwd/deque.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__iterator/move_iterator.h> #include <__iterator/next.h> #include <__iterator/prev.h> #include <__iterator/reverse_iterator.h> #include <__iterator/segmented_iterator.h> #include <__memory/addressof.h> +#include <__memory/allocator.h> #include <__memory/allocator_destructor.h> +#include <__memory/allocator_traits.h> +#include <__memory/compressed_pair.h> #include <__memory/pointer_traits.h> +#include <__memory/swap_allocator.h> #include <__memory/temp_value.h> #include <__memory/unique_ptr.h> #include <__memory_resource/polymorphic_allocator.h> @@ -211,10 +219,15 @@ template <class T, class Allocator, class Predicate> #include <__ranges/from_range.h> #include <__ranges/size.h> #include <__split_buffer> +#include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_convertible.h> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/is_same.h> #include <__type_traits/is_swappable.h> +#include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> @@ -378,10 +391,10 @@ public: return __x.__ptr_ == __y.__ptr_; } +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) { return !(__x == __y); } - _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) { return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_); } @@ -398,6 +411,30 @@ public: return !(__x < __y); } +#else + + _LIBCPP_HIDE_FROM_ABI friend strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) { + if (__x.__m_iter_ < __y.__m_iter_) + return strong_ordering::less; + + if (__x.__m_iter_ == __y.__m_iter_) { + if constexpr (three_way_comparable<pointer, strong_ordering>) { + return __x.__ptr_ <=> __y.__ptr_; + } else { + if (__x.__ptr_ < __y.__ptr_) + return strong_ordering::less; + + if (__x.__ptr_ == __y.__ptr_) + return strong_ordering::equal; + + return strong_ordering::greater; + } + } + + return strong_ordering::greater; + } +#endif // _LIBCPP_STD_VER >= 20 + private: _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT : __m_iter_(__m), @@ -560,12 +597,12 @@ private: __map __map_; size_type __start_; - __compressed_pair<size_type, allocator_type> __size_; + _LIBCPP_COMPRESSED_PAIR(size_type, __size_, allocator_type, __alloc_); public: // construct/copy/destroy: _LIBCPP_HIDE_FROM_ABI deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __start_(0), __size_(0, __default_init_tag()) { + : __start_(0), __size_(0) { __annotate_new(0); } @@ -579,7 +616,7 @@ public: } _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); } @@ -591,7 +628,7 @@ public: template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); if (__n > 0) __append(__n, __v); @@ -605,7 +642,7 @@ public: #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<_Tp> _Range> _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { __append_with_size(ranges::begin(__range), ranges::distance(__range)); @@ -668,8 +705,8 @@ public: _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v); _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __size_.second(); } - _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __size_.second(); } + _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __alloc_; } + _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __alloc_; } // iterators: @@ -708,8 +745,8 @@ public: // capacity: _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); } - _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_.first(); } - _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_.first(); } + _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_; } + _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_; } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return std::min<size_type>(__alloc_traits::max_size(__alloc()), numeric_limits<difference_type>::max()); @@ -717,7 +754,7 @@ public: _LIBCPP_HIDE_FROM_ABI void resize(size_type __n); _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v); _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; } // element access: _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT; @@ -1229,7 +1266,7 @@ deque(from_range_t, _Range&&, _Alloc = _Alloc()) -> deque<ranges::range_value_t< #endif template <class _Tp, class _Allocator> -deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0, __default_init_tag()) { +deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) { __annotate_new(0); if (__n > 0) __append(__n); @@ -1238,7 +1275,7 @@ deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0, __default #if _LIBCPP_STD_VER >= 14 template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); if (__n > 0) __append(__n); @@ -1246,7 +1283,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) #endif template <class _Tp, class _Allocator> -deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0, __default_init_tag()) { +deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0) { __annotate_new(0); if (__n > 0) __append(__n, __v); @@ -1254,7 +1291,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0 template <class _Tp, class _Allocator> template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> > -deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0, __default_init_tag()) { +deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0) { __annotate_new(0); __append(__f, __l); } @@ -1262,7 +1299,7 @@ deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __s template <class _Tp, class _Allocator> template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> > deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); __append(__f, __l); } @@ -1271,14 +1308,15 @@ template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(const deque& __c) : __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))), __start_(0), - __size_(0, __map_.__alloc()) { + __size_(0), + __alloc_(__map_.__alloc()) { __annotate_new(0); __append(__c.begin(), __c.end()); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); __append(__c.begin(), __c.end()); } @@ -1295,21 +1333,24 @@ deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) { #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Allocator> -deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) : __start_(0), __size_(0, __default_init_tag()) { +deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) : __start_(0), __size_(0) { __annotate_new(0); __append(__il.begin(), __il.end()); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a) - : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) { + : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) { __annotate_new(0); __append(__il.begin(), __il.end()); } template <class _Tp, class _Allocator> inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value) - : __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_)) { + : __map_(std::move(__c.__map_)), + __start_(std::move(__c.__start_)), + __size_(std::move(__c.__size_)), + __alloc_(std::move(__c.__alloc_)) { __c.__start_ = 0; __c.__size() = 0; } @@ -1318,7 +1359,8 @@ template <class _Tp, class _Allocator> inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a) : __map_(std::move(__c.__map_), __pointer_allocator(__a)), __start_(std::move(__c.__start_)), - __size_(std::move(__c.__size()), __a) { + __size_(std::move(__c.__size_)), + __alloc_(__a) { if (__a == __c.__alloc()) { __c.__start_ = 0; __c.__size() = 0; @@ -2532,8 +2574,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, template <class _Tp, class _Allocator> _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/exception b/contrib/libs/cxxsupp/libcxx/include/exception index 5eff8e3f8a4..64463e02cb1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/exception +++ b/contrib/libs/cxxsupp/libcxx/include/exception @@ -47,7 +47,7 @@ terminate_handler set_terminate(terminate_handler f ) noexcept; terminate_handler get_terminate() noexcept; [[noreturn]] void terminate() noexcept; -bool uncaught_exception() noexcept; +bool uncaught_exception() noexcept; // deprecated in C++17, removed in C++20 int uncaught_exceptions() noexcept; // C++17 typedef unspecified exception_ptr; diff --git a/contrib/libs/cxxsupp/libcxx/include/expected b/contrib/libs/cxxsupp/libcxx/include/expected index f455ab7d5d6..ccdbc3b1f61 100644 --- a/contrib/libs/cxxsupp/libcxx/include/expected +++ b/contrib/libs/cxxsupp/libcxx/include/expected @@ -39,14 +39,24 @@ namespace std { */ #include <__config> -#include <__expected/bad_expected_access.h> -#include <__expected/expected.h> -#include <__expected/unexpect.h> -#include <__expected/unexpected.h> + +#if _LIBCPP_STD_VER >= 20 +# include <__expected/bad_expected_access.h> +# include <__expected/expected.h> +# include <__expected/unexpect.h> +# include <__expected/unexpected.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstddef> +# include <initializer_list> +# include <new> +#endif + #endif // _LIBCPP_EXPECTED diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__config b/contrib/libs/cxxsupp/libcxx/include/experimental/__config deleted file mode 100644 index 7b23791511c..00000000000 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__config +++ /dev/null @@ -1,45 +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_EXPERIMENTAL_CONFIG -#define _LIBCPP_EXPERIMENTAL_CONFIG - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL \ - namespace std { \ - namespace experimental { -#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL \ - } \ - } - -#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { -#define _LIBCPP_END_NAMESPACE_LFTS \ - } \ - } \ - } - -#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 { -#define _LIBCPP_END_NAMESPACE_LFTS_V2 \ - } \ - } \ - } - -// TODO: support more targets -#if defined(__AVX__) -# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32 -#else -# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16 -#endif - -#endif diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h index 31d2b50aa1d..e364e146a60 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/aligned_tag.h @@ -10,10 +10,10 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H #define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H +#include <__config> #include <__memory/assume_aligned.h> #include <__type_traits/remove_const.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/traits.h> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h index 7b45d035c27..2ac7224159c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/declaration.h @@ -10,11 +10,18 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H #define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H +#include <__config> #include <cstddef> -#include <experimental/__config> #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) +// TODO: support more targets +# if defined(__AVX__) +# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32 +# else +# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16 +# endif + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 { namespace simd_abi { diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/reference.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/reference.h index af61dbcc2fe..cba460baaa9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/reference.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/reference.h @@ -10,12 +10,14 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H #define _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H +#include <__config> +#include <__type_traits/enable_if.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_same.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/utility.h> _LIBCPP_PUSH_MACROS @@ -71,6 +73,91 @@ public: template <class _Tp1, class _Storage1, class _Vp1> friend void swap(__simd_reference<_Tp1, _Storage1, _Vp1>&& __a, _Vp1& __b) noexcept; + + template <class _Up, class = decltype(std::declval<value_type&>() += std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator+=(_Up&& __v) && noexcept { + __set(__get() + static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() -= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator-=(_Up&& __v) && noexcept { + __set(__get() - static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() *= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator*=(_Up&& __v) && noexcept { + __set(__get() * static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() /= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator/=(_Up&& __v) && noexcept { + __set(__get() / static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() %= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator%=(_Up&& __v) && noexcept { + __set(__get() % static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() &= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator&=(_Up&& __v) && noexcept { + __set(__get() & static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() |= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator|=(_Up&& __v) && noexcept { + __set(__get() | static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() ^= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator^=(_Up&& __v) && noexcept { + __set(__get() ^ static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() <<= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator<<=(_Up&& __v) && noexcept { + __set(__get() << static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + template <class _Up, class = decltype(std::declval<value_type&>() >>= std::declval<_Up>())> + _LIBCPP_HIDE_FROM_ABI __simd_reference operator>>=(_Up&& __v) && noexcept { + __set(__get() >> static_cast<value_type>(std::forward<_Up>(__v))); + return {__s_, __idx_}; + } + + // Note: All legal vectorizable types support operator++/--. + // There doesn't seem to be a way to trigger the constraint. + // Therefore, no SFINAE check is added here. + __simd_reference _LIBCPP_HIDE_FROM_ABI operator++() && noexcept { + __set(__get() + 1); + return {__s_, __idx_}; + } + + value_type _LIBCPP_HIDE_FROM_ABI operator++(int) && noexcept { + auto __r = __get(); + __set(__get() + 1); + return __r; + } + + __simd_reference _LIBCPP_HIDE_FROM_ABI operator--() && noexcept { + __set(__get() - 1); + return {__s_, __idx_}; + } + + value_type _LIBCPP_HIDE_FROM_ABI operator--(int) && noexcept { + auto __r = __get(); + __set(__get() - 1); + return __r; + } }; template <class _Tp, class _Storage, class _Vp> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h index 1add4653209..a76933e1a58 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/scalar.h @@ -11,8 +11,9 @@ #define _LIBCPP_EXPERIMENTAL___SIMD_SCALAR_H #include <__assert> +#include <__config> +#include <__type_traits/integral_constant.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/declaration.h> #include <experimental/__simd/traits.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h index 37e334aad6d..2c65d19e67b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd.h @@ -10,11 +10,12 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H #define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H +#include <__config> +#include <__type_traits/enable_if.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/declaration.h> #include <experimental/__simd/reference.h> #include <experimental/__simd/traits.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h index fd6dee2e28e..55273194153 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/simd_mask.h @@ -10,9 +10,10 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H #define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H +#include <__config> +#include <__type_traits/enable_if.h> #include <__type_traits/is_same.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/declaration.h> #include <experimental/__simd/reference.h> #include <experimental/__simd/traits.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h index ec25b4bfa7f..b817df604ef 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/traits.h @@ -11,10 +11,10 @@ #define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H #include <__bit/bit_ceil.h> +#include <__config> #include <__type_traits/integral_constant.h> #include <__type_traits/is_same.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/declaration.h> #include <experimental/__simd/utility.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h index 708fa3d8f72..0103b06b719 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/utility.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H #define _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H +#include <__config> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_const.h> #include <__type_traits/is_constant_evaluated.h> @@ -22,7 +23,6 @@ #include <__utility/integer_sequence.h> #include <cstddef> #include <cstdint> -#include <experimental/__config> #include <limits> _LIBCPP_PUSH_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h index 316866b8487..6c7fb8b09a4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__simd/vec_ext.h @@ -12,10 +12,11 @@ #include <__assert> #include <__bit/bit_ceil.h> +#include <__config> +#include <__type_traits/integral_constant.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <cstddef> -#include <experimental/__config> #include <experimental/__simd/declaration.h> #include <experimental/__simd/traits.h> #include <experimental/__simd/utility.h> @@ -39,11 +40,11 @@ struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> { _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np))))); _LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds"); return __data[__idx]; } _LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept { - _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds"); + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds"); __data[__idx] = __v; } }; diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator index de82da2d3d7..e3a9c771fe6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator @@ -52,11 +52,13 @@ namespace std { */ +#include <__config> #include <__memory/addressof.h> +#include <__ostream/basic_ostream.h> +#include <__string/char_traits.h> #include <__type_traits/decay.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <experimental/__config> #include <iterator> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/memory b/contrib/libs/cxxsupp/libcxx/include/experimental/memory index e9663d43a8a..bf8a154690a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/memory +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/memory @@ -49,6 +49,7 @@ public: } */ +#include <__config> #include <__functional/hash.h> #include <__functional/operations.h> #include <__type_traits/add_lvalue_reference.h> @@ -57,7 +58,6 @@ public: #include <__type_traits/enable_if.h> #include <__type_traits/is_convertible.h> #include <cstddef> -#include <experimental/__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const b/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const index d7a695d8388..510d374bb4b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/propagate_const @@ -107,6 +107,7 @@ */ +#include <__config> #include <__functional/operations.h> #include <__fwd/functional.h> #include <__type_traits/conditional.h> @@ -128,7 +129,6 @@ #include <__utility/move.h> #include <__utility/swap.h> #include <cstddef> -#include <experimental/__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/simd b/contrib/libs/cxxsupp/libcxx/include/experimental/simd index 484543b81da..35120b4b4aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/simd +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/simd @@ -75,7 +75,7 @@ inline namespace parallelism_v2 { # pragma GCC system_header #endif -#include <experimental/__config> +#include <__config> #include <experimental/__simd/aligned_tag.h> #include <experimental/__simd/declaration.h> #include <experimental/__simd/reference.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits b/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits index 31b041bc94c..a4bb59afaf4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/type_traits @@ -68,7 +68,7 @@ inline namespace fundamentals_v1 { */ -#include <experimental/__config> +#include <__config> #if _LIBCPP_STD_VER >= 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/utility b/contrib/libs/cxxsupp/libcxx/include/experimental/utility index 8bd0a055b77..cbc7ad140e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/utility +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/utility @@ -30,7 +30,7 @@ inline namespace fundamentals_v1 { */ -#include <experimental/__config> +#include <__config> #include <utility> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index eff7dff4a45..6ea04df0a08 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -534,22 +534,26 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct */ #include <__config> -#include <__filesystem/copy_options.h> -#include <__filesystem/directory_entry.h> -#include <__filesystem/directory_iterator.h> -#include <__filesystem/directory_options.h> -#include <__filesystem/file_status.h> -#include <__filesystem/file_time_type.h> -#include <__filesystem/file_type.h> -#include <__filesystem/filesystem_error.h> -#include <__filesystem/operations.h> -#include <__filesystem/path.h> -#include <__filesystem/path_iterator.h> -#include <__filesystem/perm_options.h> -#include <__filesystem/perms.h> -#include <__filesystem/recursive_directory_iterator.h> -#include <__filesystem/space_info.h> -#include <__filesystem/u8path.h> + +#if _LIBCPP_STD_VER >= 17 +# include <__filesystem/copy_options.h> +# include <__filesystem/directory_entry.h> +# include <__filesystem/directory_iterator.h> +# include <__filesystem/directory_options.h> +# include <__filesystem/file_status.h> +# include <__filesystem/file_time_type.h> +# include <__filesystem/file_type.h> +# include <__filesystem/filesystem_error.h> +# include <__filesystem/operations.h> +# include <__filesystem/path.h> +# include <__filesystem/path_iterator.h> +# include <__filesystem/perm_options.h> +# include <__filesystem/perms.h> +# include <__filesystem/recursive_directory_iterator.h> +# include <__filesystem/space_info.h> +# include <__filesystem/u8path.h> +#endif + #include <version> // standard-mandated includes diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index 07c2ba08319..449e6f0bf3f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -126,6 +126,9 @@ namespace std { // [format.formatter], formatter template<class T, class charT = char> struct formatter; + template<class T> + constexpr bool enable_nonlocking_formatter_optimization = false; // since C++23 + // [format.parse.ctx], class template basic_format_parse_context template<class charT> class basic_format_parse_context; using format_parse_context = basic_format_parse_context<char>; @@ -133,7 +136,7 @@ namespace std { // [format.range], formatting of ranges // [format.range.fmtkind], variable template format_kind - enum class range_format { // since C++23 + enum class range_format { // since C++23 disabled, map, set, @@ -143,20 +146,20 @@ namespace std { }; template<class R> - constexpr unspecified format_kind = unspecified; // since C++23 + constexpr unspecified format_kind = unspecified; // since C++23 template<ranges::input_range R> requires same_as<R, remove_cvref_t<R>> - constexpr range_format format_kind<R> = see below; // since C++23 + constexpr range_format format_kind<R> = see below; // since C++23 // [format.range.formatter], class template range_formatter template<class T, class charT = char> requires same_as<remove_cvref_t<T>, T> && formattable<T, charT> - class range_formatter; // since C++23 + class range_formatter; // since C++23 // [format.range.fmtdef], class template range-default-formatter template<range_format K, ranges::input_range R, class charT> - struct range-default-formatter; // exposition only, since C++23 + struct range-default-formatter; // exposition only, since C++23 // [format.range.fmtmap], [format.range.fmtset], [format.range.fmtstr], // specializations for maps, sets, and strings @@ -173,7 +176,7 @@ namespace std { see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg); // Deprecated in C++26 // [format.arg.store], class template format-arg-store - template<class Context, class... Args> struct format-arg-store; // exposition only + template<class Context, class... Args> struct format-arg-store; // exposition only template<class Context = format_context, class... Args> format-arg-store<Context, Args...> @@ -189,34 +192,38 @@ namespace std { */ #include <__config> -#include <__format/buffer.h> -#include <__format/concepts.h> -#include <__format/container_adaptor.h> -#include <__format/enable_insertable.h> -#include <__format/escaped_output_table.h> -#include <__format/extended_grapheme_cluster_table.h> -#include <__format/format_arg.h> -#include <__format/format_arg_store.h> -#include <__format/format_args.h> -#include <__format/format_context.h> -#include <__format/format_error.h> -#include <__format/format_functions.h> -#include <__format/format_parse_context.h> -#include <__format/format_string.h> -#include <__format/format_to_n_result.h> -#include <__format/formatter.h> -#include <__format/formatter_bool.h> -#include <__format/formatter_char.h> -#include <__format/formatter_floating_point.h> -#include <__format/formatter_integer.h> -#include <__format/formatter_pointer.h> -#include <__format/formatter_string.h> -#include <__format/formatter_tuple.h> -#include <__format/parser_std_format_spec.h> -#include <__format/range_default_formatter.h> -#include <__format/range_formatter.h> -#include <__format/unicode.h> -#include <__fwd/format.h> + +#if _LIBCPP_STD_VER >= 20 +# include <__format/buffer.h> +# include <__format/concepts.h> +# include <__format/container_adaptor.h> +# include <__format/enable_insertable.h> +# include <__format/escaped_output_table.h> +# include <__format/extended_grapheme_cluster_table.h> +# include <__format/format_arg.h> +# include <__format/format_arg_store.h> +# include <__format/format_args.h> +# include <__format/format_context.h> +# include <__format/format_error.h> +# include <__format/format_functions.h> +# include <__format/format_parse_context.h> +# include <__format/format_string.h> +# include <__format/format_to_n_result.h> +# include <__format/formatter.h> +# include <__format/formatter_bool.h> +# include <__format/formatter_char.h> +# include <__format/formatter_floating_point.h> +# include <__format/formatter_integer.h> +# include <__format/formatter_pointer.h> +# include <__format/formatter_string.h> +# include <__format/formatter_tuple.h> +# include <__format/parser_std_format_spec.h> +# include <__format/range_default_formatter.h> +# include <__format/range_formatter.h> +# include <__format/unicode.h> +# include <__fwd/format.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -224,9 +231,30 @@ namespace std { #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <array> +# include <cctype> +# include <cerrno> +# include <clocale> +# include <cmath> +# include <cstddef> +# include <cstdint> +# include <cstdlib> +# include <cstring> +# include <initializer_list> +# include <limits> # include <locale> +# include <new> +# include <optional> # include <queue> # include <stack> +# include <stdexcept> +# include <string> +# include <string_view> +# include <tuple> + +# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include <cwchar> +# endif #endif #endif // _LIBCPP_FORMAT diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index 1ae19d23f88..c5ae8add511 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -218,15 +218,18 @@ template <class T, class Allocator, class Predicate> #include <__ranges/container_compatible_range.h> #include <__ranges/from_range.h> #include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_const.h> #include <__type_traits/is_nothrow_assignable.h> #include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/is_pointer.h> #include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> #include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> +#include <__utility/swap.h> #include <limits> #include <new> // __launder #include <version> @@ -275,18 +278,20 @@ struct __forward_node_traits { typedef __rebind_pointer_t<_NodePtr, __begin_node> __begin_node_pointer; typedef __rebind_pointer_t<_NodePtr, void> __void_pointer; -#if defined(_LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB) - typedef __begin_node_pointer __iter_node_pointer; -#else - typedef __conditional_t<is_pointer<__void_pointer>::value, __begin_node_pointer, __node_pointer> __iter_node_pointer; +// TODO(LLVM 22): Remove this check +#ifndef _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB + static_assert(sizeof(__begin_node_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__begin_node_pointer) == + _LIBCPP_ALIGNOF(__node_pointer), + "It looks like you are using std::forward_list with a fancy pointer type that thas a different " + "representation depending on whether it points to a forward_list base pointer or a forward_list node " + "pointer (both of which are implementation details of the standard library). This means that your ABI " + "is being broken between LLVM 19 and LLVM 20. If you don't care about your ABI being broken, define " + "the _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB macro to silence this diagnostic."); #endif - typedef __conditional_t<is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer> - __non_iter_node_pointer; - - _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { return __p; } - _LIBCPP_HIDE_FROM_ABI static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) { - return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p)); + _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node(__begin_node_pointer __p) { return __p; } + _LIBCPP_HIDE_FROM_ABI static __begin_node_pointer __as_iter_node(__node_pointer __p) { + return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__p)); } }; @@ -348,10 +353,9 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_iterator { typedef __forward_node_traits<_NodePtr> __traits; typedef typename __traits::__node_pointer __node_pointer; typedef typename __traits::__begin_node_pointer __begin_node_pointer; - typedef typename __traits::__iter_node_pointer __iter_node_pointer; typedef typename __traits::__void_pointer __void_pointer; - __iter_node_pointer __ptr_; + __begin_node_pointer __ptr_; _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const { return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_)); @@ -414,10 +418,9 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator { typedef typename __traits::__node_type __node_type; typedef typename __traits::__node_pointer __node_pointer; typedef typename __traits::__begin_node_pointer __begin_node_pointer; - typedef typename __traits::__iter_node_pointer __iter_node_pointer; typedef typename __traits::__void_pointer __void_pointer; - __iter_node_pointer __ptr_; + __begin_node_pointer __ptr_; _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const { return static_cast<__begin_node_pointer>(static_cast<__void_pointer>(__ptr_)); @@ -489,27 +492,27 @@ protected: typedef __rebind_alloc<allocator_traits<allocator_type>, __begin_node> __begin_node_allocator; typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer; - __compressed_pair<__begin_node, __node_allocator> __before_begin_; + _LIBCPP_COMPRESSED_PAIR(__begin_node, __before_begin_, __node_allocator, __alloc_); _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() _NOEXCEPT { - return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first()); + return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_); } _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __before_begin() const _NOEXCEPT { - return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first())); + return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_)); } - _LIBCPP_HIDE_FROM_ABI __node_allocator& __alloc() _NOEXCEPT { return __before_begin_.second(); } - _LIBCPP_HIDE_FROM_ABI const __node_allocator& __alloc() const _NOEXCEPT { return __before_begin_.second(); } + _LIBCPP_HIDE_FROM_ABI __node_allocator& __alloc() _NOEXCEPT { return __alloc_; } + _LIBCPP_HIDE_FROM_ABI const __node_allocator& __alloc() const _NOEXCEPT { return __alloc_; } typedef __forward_list_iterator<__node_pointer> iterator; typedef __forward_list_const_iterator<__node_pointer> const_iterator; _LIBCPP_HIDE_FROM_ABI __forward_list_base() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - : __before_begin_(__begin_node(), __default_init_tag()) {} + : __before_begin_(__begin_node()) {} _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const allocator_type& __a) - : __before_begin_(__begin_node(), __node_allocator(__a)) {} + : __before_begin_(__begin_node()), __alloc_(__node_allocator(__a)) {} _LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a) - : __before_begin_(__begin_node(), __a) {} + : __before_begin_(__begin_node()), __alloc_(__a) {} public: #ifndef _LIBCPP_CXX03_LANG @@ -591,13 +594,13 @@ private: template <class _Tp, class _Alloc> inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) noexcept( is_nothrow_move_constructible<__node_allocator>::value) - : __before_begin_(std::move(__x.__before_begin_)) { + : __before_begin_(std::move(__x.__before_begin_)), __alloc_(std::move(__x.__alloc_)) { __x.__before_begin()->__next_ = nullptr; } template <class _Tp, class _Alloc> inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a) - : __before_begin_(__begin_node(), __node_allocator(__a)) { + : __before_begin_(__begin_node()), __alloc_(__node_allocator(__a)) { if (__alloc() == __x.__alloc()) { __before_begin()->__next_ = __x.__before_begin()->__next_; __x.__before_begin()->__next_ = nullptr; @@ -619,8 +622,7 @@ inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>) #endif { - std::__swap_allocator( - __alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>()); + std::__swap_allocator(__alloc(), __x.__alloc()); using std::swap; swap(__before_begin()->__next_, __x.__before_begin()->__next_); } @@ -755,7 +757,7 @@ public: return const_iterator(base::__before_begin()); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return base::__before_begin()->__next_ == nullptr; } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { @@ -1517,8 +1519,7 @@ operator<=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc> template <class _Tp, class _Allocator> _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> operator<=>(const forward_list<_Tp, _Allocator>& __x, const forward_list<_Tp, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // #if _LIBCPP_STD_VER <= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/fstream b/contrib/libs/cxxsupp/libcxx/include/fstream index ab5ebf8e2c3..de7c614836b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/fstream +++ b/contrib/libs/cxxsupp/libcxx/include/fstream @@ -189,15 +189,16 @@ typedef basic_fstream<wchar_t> wfstream; #include <__algorithm/max.h> #include <__assert> #include <__config> +#include <__filesystem/path.h> #include <__fwd/fstream.h> #include <__locale> +#include <__memory/addressof.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_same.h> #include <__utility/move.h> #include <__utility/swap.h> #include <__utility/unreachable.h> #include <cstdio> -#include <filesystem> #include <istream> #include <ostream> #include <typeinfo> @@ -214,7 +215,7 @@ _LIBCPP_PUSH_MACROS # define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS #endif -#if !defined(_LIBCPP_HAS_NO_FILESYSTEM) +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) _LIBCPP_BEGIN_NAMESPACE_STD @@ -1136,11 +1137,12 @@ private: }; template <class _CharT, class _Traits> -inline basic_ifstream<_CharT, _Traits>::basic_ifstream() : basic_istream<char_type, traits_type>(&__sb_) {} +inline basic_ifstream<_CharT, _Traits>::basic_ifstream() + : basic_istream<char_type, traits_type>(std::addressof(__sb_)) {} template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode) - : basic_istream<char_type, traits_type>(&__sb_) { + : basic_istream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::in) == nullptr) this->setstate(ios_base::failbit); } @@ -1148,15 +1150,16 @@ inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode) - : basic_istream<char_type, traits_type>(&__sb_) { + : basic_istream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::in) == nullptr) this->setstate(ios_base::failbit); } # endif +// extension template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode) - : basic_istream<char_type, traits_type>(&__sb_) { + : basic_istream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::in) == nullptr) this->setstate(ios_base::failbit); } @@ -1164,7 +1167,7 @@ inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_ba template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) : basic_istream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - this->set_rdbuf(&__sb_); + this->set_rdbuf(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1187,7 +1190,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream<_CharT, _Traits>& __x, bas template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_ifstream<_CharT, _Traits>::rdbuf() const { - return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); + return const_cast<basic_filebuf<char_type, traits_type>*>(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1293,11 +1296,12 @@ private: }; template <class _CharT, class _Traits> -inline basic_ofstream<_CharT, _Traits>::basic_ofstream() : basic_ostream<char_type, traits_type>(&__sb_) {} +inline basic_ofstream<_CharT, _Traits>::basic_ofstream() + : basic_ostream<char_type, traits_type>(std::addressof(__sb_)) {} template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode) - : basic_ostream<char_type, traits_type>(&__sb_) { + : basic_ostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::out) == nullptr) this->setstate(ios_base::failbit); } @@ -1305,15 +1309,16 @@ inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode) - : basic_ostream<char_type, traits_type>(&__sb_) { + : basic_ostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::out) == nullptr) this->setstate(ios_base::failbit); } # endif +// extension template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode) - : basic_ostream<char_type, traits_type>(&__sb_) { + : basic_ostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode | ios_base::out) == nullptr) this->setstate(ios_base::failbit); } @@ -1321,7 +1326,7 @@ inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_ba template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) : basic_ostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - this->set_rdbuf(&__sb_); + this->set_rdbuf(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1344,7 +1349,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream<_CharT, _Traits>& __x, bas template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_ofstream<_CharT, _Traits>::rdbuf() const { - return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); + return const_cast<basic_filebuf<char_type, traits_type>*>(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1454,11 +1459,12 @@ private: }; template <class _CharT, class _Traits> -inline basic_fstream<_CharT, _Traits>::basic_fstream() : basic_iostream<char_type, traits_type>(&__sb_) {} +inline basic_fstream<_CharT, _Traits>::basic_fstream() + : basic_iostream<char_type, traits_type>(std::addressof(__sb_)) {} template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode) - : basic_iostream<char_type, traits_type>(&__sb_) { + : basic_iostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode) == nullptr) this->setstate(ios_base::failbit); } @@ -1466,7 +1472,7 @@ inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base:: # ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode) - : basic_iostream<char_type, traits_type>(&__sb_) { + : basic_iostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode) == nullptr) this->setstate(ios_base::failbit); } @@ -1474,15 +1480,16 @@ inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_bas template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode) - : basic_iostream<char_type, traits_type>(&__sb_) { + : basic_iostream<char_type, traits_type>(std::addressof(__sb_)) { if (__sb_.open(__s, __mode) == nullptr) this->setstate(ios_base::failbit); } +// extension template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) : basic_iostream<char_type, traits_type>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - this->set_rdbuf(&__sb_); + this->set_rdbuf(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1505,7 +1512,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(basic_fstream<_CharT, _Traits>& __x, basi template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_fstream<_CharT, _Traits>::rdbuf() const { - return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); + return const_cast<basic_filebuf<char_type, traits_type>*>(std::addressof(__sb_)); } template <class _CharT, class _Traits> @@ -1553,7 +1560,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>; _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_HAS_NO_FILESYSTEM +#endif // !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) _LIBCPP_POP_MACROS @@ -1569,4 +1576,8 @@ _LIBCPP_POP_MACROS # include <type_traits> #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 +# include <filesystem> +#endif + #endif // _LIBCPP_FSTREAM diff --git a/contrib/libs/cxxsupp/libcxx/include/functional b/contrib/libs/cxxsupp/libcxx/include/functional index 27cf21e1a4c..3d39f654ddb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/functional +++ b/contrib/libs/cxxsupp/libcxx/include/functional @@ -527,41 +527,60 @@ POLICY: For non-variadic implementations, the number of arguments is limited */ -#include <__algorithm/search.h> -#include <__compare/compare_three_way.h> #include <__config> + #include <__functional/binary_function.h> #include <__functional/binary_negate.h> #include <__functional/bind.h> -#include <__functional/bind_back.h> -#include <__functional/bind_front.h> #include <__functional/binder1st.h> #include <__functional/binder2nd.h> -#include <__functional/boyer_moore_searcher.h> -#include <__functional/compose.h> -#include <__functional/default_searcher.h> -#include <__functional/function.h> #include <__functional/hash.h> -#include <__functional/identity.h> -#include <__functional/invoke.h> #include <__functional/mem_fn.h> // TODO: deprecate #include <__functional/mem_fun_ref.h> -#include <__functional/not_fn.h> #include <__functional/operations.h> #include <__functional/pointer_to_binary_function.h> #include <__functional/pointer_to_unary_function.h> -#include <__functional/ranges_operations.h> #include <__functional/reference_wrapper.h> #include <__functional/unary_function.h> #include <__functional/unary_negate.h> -#include <__type_traits/unwrap_ref.h> -#include <__utility/forward.h> + +#ifndef _LIBCPP_CXX03_LANG +# include <__functional/function.h> +#endif + +#if _LIBCPP_STD_VER >= 17 +# include <__functional/boyer_moore_searcher.h> +# include <__functional/default_searcher.h> +# include <__functional/invoke.h> +# include <__functional/not_fn.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__functional/bind_back.h> +# include <__functional/bind_front.h> +# include <__functional/identity.h> +# include <__functional/ranges_operations.h> +# include <__type_traits/unwrap_ref.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_CXX03_LANG) +# include <limits> +# include <new> +#endif + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 +# include <array> +# include <initializer_list> +# include <unordered_map> +# include <vector> +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/future b/contrib/libs/cxxsupp/libcxx/include/future index dea73dc6389..7dc38a3354b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/future +++ b/contrib/libs/cxxsupp/libcxx/include/future @@ -329,7 +329,7 @@ public: template <class F> explicit packaged_task(F&& f); template <class F, class Allocator> - packaged_task(allocator_arg_t, const Allocator& a, F&& f); + packaged_task(allocator_arg_t, const Allocator& a, F&& f); // removed in C++17 ~packaged_task(); // no copy @@ -356,7 +356,7 @@ public: template <class R> void swap(packaged_task<R(ArgTypes...)&, packaged_task<R(ArgTypes...)>&) noexcept; -template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; +template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; // removed in C++17 } // std @@ -364,44 +364,48 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<future> is not supported since libc++ has been configured without support for threads." -#endif - -#include <__assert> -#include <__chrono/duration.h> -#include <__chrono/time_point.h> -#include <__exception/exception_ptr.h> -#include <__memory/addressof.h> -#include <__memory/allocator.h> -#include <__memory/allocator_arg_t.h> -#include <__memory/allocator_destructor.h> -#include <__memory/allocator_traits.h> -#include <__memory/compressed_pair.h> -#include <__memory/pointer_traits.h> -#include <__memory/shared_ptr.h> -#include <__memory/unique_ptr.h> -#include <__memory/uses_allocator.h> -#include <__system_error/error_category.h> -#include <__system_error/error_code.h> -#include <__system_error/error_condition.h> -#include <__type_traits/aligned_storage.h> -#include <__type_traits/strip_signature.h> -#include <__utility/auto_cast.h> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <mutex> -#include <new> -#include <stdexcept> -#include <thread> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) + +# include <__assert> +# include <__chrono/duration.h> +# include <__chrono/time_point.h> +# include <__condition_variable/condition_variable.h> +# include <__exception/exception_ptr.h> +# include <__memory/addressof.h> +# include <__memory/allocator.h> +# include <__memory/allocator_arg_t.h> +# include <__memory/allocator_destructor.h> +# include <__memory/allocator_traits.h> +# include <__memory/compressed_pair.h> +# include <__memory/pointer_traits.h> +# include <__memory/shared_ptr.h> +# include <__memory/unique_ptr.h> +# include <__memory/uses_allocator.h> +# include <__system_error/error_category.h> +# include <__system_error/error_code.h> +# include <__system_error/error_condition.h> +# include <__type_traits/add_lvalue_reference.h> +# include <__type_traits/aligned_storage.h> +# include <__type_traits/conditional.h> +# include <__type_traits/decay.h> +# include <__type_traits/enable_if.h> +# include <__type_traits/strip_signature.h> +# include <__type_traits/underlying_type.h> +# include <__utility/auto_cast.h> +# include <__utility/forward.h> +# include <__utility/move.h> +# include <mutex> +# include <new> +# include <stdexcept> +# include <thread> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -413,16 +417,16 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc) template <> struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc> : public true_type {}; -#ifdef _LIBCPP_CXX03_LANG +# ifdef _LIBCPP_CXX03_LANG template <> struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type {}; -#endif +# endif // enum class launch _LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred}; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) -#ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG typedef underlying_type<launch>::type __launch_underlying_type; @@ -457,7 +461,7 @@ inline _LIBCPP_HIDE_FROM_ABI launch& operator^=(launch& __x, launch __y) { return __x; } -#endif // !_LIBCPP_CXX03_LANG +# endif // !_LIBCPP_CXX03_LANG // enum class future_status _LIBCPP_DECLARE_STRONG_ENUM(future_status){ready, timeout, deferred}; @@ -473,7 +477,7 @@ inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(future_errc __ return error_condition(static_cast<int>(__e), future_category()); } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev); +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_future_error(future_errc __ev); class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error { error_code __ec_; @@ -484,9 +488,9 @@ class _LIBCPP_EXPORTED_FROM_ABI future_error : public logic_error { friend class promise; public: -#if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 _LIBCPP_HIDE_FROM_ABI explicit future_error(future_errc __ec) : future_error(std::make_error_code(__ec)) {} -#endif +# endif _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; } @@ -496,12 +500,12 @@ public: // Declared above std::future_error void __throw_future_error(future_errc __ev) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw future_error(make_error_code(__ev)); -#else +# else (void)__ev; _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode"); -#endif +# endif } class _LIBCPP_EXPORTED_FROM_ABI __assoc_sub_state : public __shared_count { @@ -775,15 +779,15 @@ inline __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) : __f template <class _Rp, class _Fp> void __deferred_assoc_state<_Rp, _Fp>::__execute() { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->set_value(__func_()); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Fp> @@ -805,16 +809,16 @@ inline __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) : __ template <class _Fp> void __deferred_assoc_state<void, _Fp>::__execute() { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __func_(); this->set_value(); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class _Fp> @@ -836,15 +840,15 @@ inline __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(s template <class _Rp, class _Fp> void __async_assoc_state<_Rp, _Fp>::__execute() { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->set_value(__func_()); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class _Fp> @@ -872,16 +876,16 @@ inline __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) : __func_( template <class _Fp> void __async_assoc_state<void, _Fp>::__execute() { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __func_(); this->set_value(); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Fp> @@ -1386,7 +1390,7 @@ template <class _Rp, class... _ArgTypes> class __packaged_task_base<_Rp(_ArgTypes...)> { public: _LIBCPP_HIDE_FROM_ABI __packaged_task_base() {} - __packaged_task_base(const __packaged_task_base&) = delete; + __packaged_task_base(const __packaged_task_base&) = delete; __packaged_task_base& operator=(const __packaged_task_base&) = delete; _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__packaged_task_base() {} @@ -1401,13 +1405,13 @@ class __packaged_task_func; template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> { - __compressed_pair<_Fp, _Alloc> __f_; + _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Alloc, __alloc_); public: - _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {} - _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(_Fp&& __f) : __f_(std::move(__f), __default_init_tag()) {} - _LIBCPP_HIDE_FROM_ABI __packaged_task_func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {} - _LIBCPP_HIDE_FROM_ABI __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __f_(std::move(__f), __a) {} + _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __func_(__f) {} + _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(_Fp&& __f) : __func_(std::move(__f)) {} + _LIBCPP_HIDE_FROM_ABI __packaged_task_func(const _Fp& __f, const _Alloc& __a) : __func_(__f), __alloc_(__a) {} + _LIBCPP_HIDE_FROM_ABI __packaged_task_func(_Fp&& __f, const _Alloc& __a) : __func_(std::move(__f)), __alloc_(__a) {} _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy(); _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate(); @@ -1417,12 +1421,13 @@ public: template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT { - ::new ((void*)__p) __packaged_task_func(std::move(__f_.first()), std::move(__f_.second())); + ::new ((void*)__p) __packaged_task_func(std::move(__func_), std::move(__alloc_)); } template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() { - __f_.~__compressed_pair<_Fp, _Alloc>(); + __func_.~_Fp(); + __alloc_.~_Alloc(); } template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> @@ -1430,14 +1435,15 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap; typedef allocator_traits<_Ap> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; - _Ap __a(__f_.second()); - __f_.~__compressed_pair<_Fp, _Alloc>(); + _Ap __a(__alloc_); + __func_.~_Fp(); + __alloc_.~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1); } template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes> _Rp __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) { - return std::__invoke(__f_.first(), std::forward<_ArgTypes>(__arg)...); + return std::__invoke(__func_, std::forward<_ArgTypes>(__arg)...); } template <class _Callable> @@ -1607,9 +1613,11 @@ public: template <class _Fp, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {} +# if _LIBCPP_STD_VER <= 14 template <class _Fp, class _Allocator, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {} +# endif // ~packaged_task() = default; // no copy @@ -1648,15 +1656,15 @@ void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) { __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __p_.set_value(__f_(std::forward<_ArgTypes>(__args)...)); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class... _ArgTypes> @@ -1665,15 +1673,15 @@ void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...)); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception_at_thread_exit(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class... _ArgTypes> @@ -1697,9 +1705,11 @@ public: _LIBCPP_HIDE_FROM_ABI packaged_task() _NOEXCEPT : __p_(nullptr) {} template <class _Fp, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit packaged_task(_Fp&& __f) : __f_(std::forward<_Fp>(__f)) {} +# if _LIBCPP_STD_VER <= 14 template <class _Fp, class _Allocator, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) : __f_(allocator_arg_t(), __a, std::forward<_Fp>(__f)), __p_(allocator_arg_t(), __a) {} +# endif // ~packaged_task() = default; // no copy @@ -1732,7 +1742,7 @@ public: _LIBCPP_HIDE_FROM_ABI void reset(); }; -#if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 template <class _Rp, class... _Args> packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>; @@ -1740,7 +1750,7 @@ packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>; template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> packaged_task(_Fp) -> packaged_task<_Stripped>; -#endif +# endif template <class... _ArgTypes> void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) { @@ -1748,16 +1758,16 @@ void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) { __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __f_(std::forward<_ArgTypes>(__args)...); __p_.set_value(); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class... _ArgTypes> @@ -1766,16 +1776,16 @@ void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... _ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __f_(std::forward<_ArgTypes>(__args)...); __p_.set_value_at_thread_exit(); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception_at_thread_exit(current_exception()); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class... _ArgTypes> @@ -1791,8 +1801,10 @@ swap(packaged_task<_Rp(_ArgTypes...)>& __x, packaged_task<_Rp(_ArgTypes...)>& __ __x.swap(__y); } +# if _LIBCPP_STD_VER <= 14 template <class _Callable, class _Alloc> struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc> : public true_type {}; +# endif template <class _Rp, class _Fp> _LIBCPP_HIDE_FROM_ABI future<_Rp> __make_deferred_assoc_state(_Fp&& __f) { @@ -1809,7 +1821,7 @@ _LIBCPP_HIDE_FROM_ABI future<_Rp> __make_async_assoc_state(_Fp&& __f) { return future<_Rp>(__h.get()); } -#ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG template <class _Fp, class... _Args> class _LIBCPP_HIDDEN __async_func { @@ -1840,23 +1852,23 @@ inline _LIBCPP_HIDE_FROM_ABI bool __does_policy_contain(launch __policy, launch } template <class _Fp, class... _Args> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> async(launch __policy, _Fp&& __f, _Args&&... __args) { typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF; typedef typename _BF::_Rp _Rp; -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif +# endif if (__does_policy_contain(__policy, launch::async)) return std::__make_async_assoc_state<_Rp>( _BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...)); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { if (__policy == launch::async) throw; } -# endif +# endif if (__does_policy_contain(__policy, launch::deferred)) return std::__make_deferred_assoc_state<_Rp>( @@ -1865,12 +1877,12 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) { } template <class _Fp, class... _Args> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> async(_Fp&& __f, _Args&&... __args) { return std::async(launch::any, std::forward<_Fp>(__f), std::forward<_Args>(__args)...); } -#endif // C++03 +# endif // C++03 // shared_future @@ -2047,6 +2059,8 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 # include <chrono> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/iomanip b/contrib/libs/cxxsupp/libcxx/include/iomanip index fb4f15b9a58..2c4023d4ee4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iomanip +++ b/contrib/libs/cxxsupp/libcxx/include/iomanip @@ -43,12 +43,17 @@ template <class charT, class traits, class Allocator> */ #include <__config> -#include <istream> -#include <version> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +#ifndef _LIBCPP_HAS_NO_LOCALIZATION + +# include <__ostream/basic_ostream.h> +# include <ios> +# include <istream> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -231,9 +236,9 @@ public: template <class _CharT, class _Traits, class _MoneyT> _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; @@ -243,11 +248,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) { __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); __is.setstate(__err); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __is.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __is; } @@ -280,9 +285,9 @@ public: template <class _CharT, class _Traits, class _MoneyT> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; @@ -291,11 +296,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) { if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) __os.setstate(ios_base::badbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -328,9 +333,9 @@ public: template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; @@ -340,11 +345,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) { __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __is.setstate(__err); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __is.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __is; } @@ -377,9 +382,9 @@ public: template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; @@ -389,11 +394,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) { .failed()) __os.setstate(ios_base::badbit); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -505,7 +510,7 @@ __quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape); } -#if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 14 template <class _CharT> _LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) { @@ -535,8 +540,10 @@ quoted(basic_string_view<_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _C return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape); } -#endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD +#endif // !_LIBCPP_HAS_NO_LOCALIZATION + #endif // _LIBCPP_IOMANIP diff --git a/contrib/libs/cxxsupp/libcxx/include/ios b/contrib/libs/cxxsupp/libcxx/include/ios index a653af005a1..61a05fadd29 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ios +++ b/contrib/libs/cxxsupp/libcxx/include/ios @@ -213,36 +213,35 @@ storage-class-specifier const error_category& iostream_category() noexcept; #include <__config> -#if defined(_LIBCPP_HAS_NO_LOCALIZATION) -# error "The iostreams library is not supported since libc++ has been configured without support for localization." -#endif - -#include <__fwd/ios.h> -#include <__ios/fpos.h> -#include <__locale> -#include <__system_error/error_category.h> -#include <__system_error/error_code.h> -#include <__system_error/error_condition.h> -#include <__system_error/system_error.h> -#include <__utility/swap.h> -#include <__verbose_abort> -#include <version> +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__fwd/ios.h> +# include <__ios/fpos.h> +# include <__locale> +# include <__memory/addressof.h> +# include <__system_error/error_category.h> +# include <__system_error/error_code.h> +# include <__system_error/error_condition.h> +# include <__system_error/system_error.h> +# include <__utility/swap.h> +# include <__verbose_abort> +# include <version> // standard-mandated includes // [ios.syn] -#include <iosfwd> +# include <iosfwd> -#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include <__atomic/atomic.h> // for __xindex_ -#endif +# if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) +# include <__atomic/atomic.h> // for __xindex_ +# endif -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -285,20 +284,20 @@ public: static const openmode in = 0x08; static const openmode out = 0x10; static const openmode trunc = 0x20; -#if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 23 static const openmode noreplace = 0x40; -#endif +# endif enum seekdir { beg, cur, end }; -#if _LIBCPP_STD_VER <= 14 +# if _LIBCPP_STD_VER <= 14 typedef iostate io_state; typedef openmode open_mode; typedef seekdir seek_dir; typedef std::streamoff streamoff; typedef std::streampos streampos; -#endif +# endif class _LIBCPP_EXPORTED_FROM_ABI Init; @@ -398,11 +397,11 @@ private: size_t __event_cap_; // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only // enabled with clang. -#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS) +# if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS) static atomic<int> __xindex_; -#else +# else static int __xindex_; -#endif +# endif long* __iarray_; size_t __iarray_size_; size_t __iarray_cap_; @@ -418,10 +417,10 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc) template <> struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {}; -#ifdef _LIBCPP_CXX03_LANG +# ifdef _LIBCPP_CXX03_LANG template <> struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {}; -#endif +# endif _LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT; @@ -441,12 +440,12 @@ public: ~failure() _NOEXCEPT override; }; -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) { +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw ios_base::failure(__msg); -#else +# else _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg); -#endif +# endif } class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init { @@ -521,6 +520,38 @@ inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) { clear(__rdstate_); } +template <class _Traits> +// Attribute 'packed' is used to keep the layout compatible with the previous +// definition of the '__fill_' and '_set_' pair in basic_ios on AIX & z/OS. +struct _LIBCPP_PACKED _FillHelper { + _LIBCPP_HIDE_FROM_ABI void __init() { __set_ = false; } + _LIBCPP_HIDE_FROM_ABI _FillHelper& operator=(typename _Traits::int_type __x) { + __set_ = true; + __fill_val_ = __x; + return *this; + } + _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __set_; } + _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; } + +private: + typename _Traits::int_type __fill_val_; + bool __set_; +}; + +template <class _Traits> +struct _LIBCPP_PACKED _SentinelValueFill { + _LIBCPP_HIDE_FROM_ABI void __init() { __fill_val_ = _Traits::eof(); } + _LIBCPP_HIDE_FROM_ABI _SentinelValueFill& operator=(typename _Traits::int_type __x) { + __fill_val_ = __x; + return *this; + } + _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __fill_val_ != _Traits::eof(); } + _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; } + +private: + typename _Traits::int_type __fill_val_; +}; + template <class _CharT, class _Traits> class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base { public: @@ -535,13 +566,13 @@ public: static_assert(is_same<_CharT, typename traits_type::char_type>::value, "traits_type::char_type must be the same type as CharT"); -#ifdef _LIBCPP_CXX03_LANG +# ifdef _LIBCPP_CXX03_LANG // Preserve the ability to compare with literal 0, // and implicitly convert to bool, but not implicitly convert to int. _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; } -#else +# else _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); } -#endif +# endif _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); } _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); } @@ -590,7 +621,13 @@ protected: private: basic_ostream<char_type, traits_type>* __tie_; - mutable int_type __fill_; + +# if defined(_LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE) + using _FillType = _FillHelper<traits_type>; +# else + using _FillType = _SentinelValueFill<traits_type>; +# endif + mutable _FillType __fill_; }; template <class _CharT, class _Traits> @@ -604,8 +641,8 @@ basic_ios<_CharT, _Traits>::~basic_ios() {} template <class _CharT, class _Traits> inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) { ios_base::init(__sb); - __tie_ = nullptr; - __fill_ = traits_type::eof(); + __tie_ = nullptr; + __fill_.__init(); } template <class _CharT, class _Traits> @@ -655,23 +692,23 @@ inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) template <class _CharT, class _Traits> inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const { - if (traits_type::eq_int_type(traits_type::eof(), __fill_)) + if (!__fill_.__is_set()) __fill_ = widen(' '); - return __fill_; + return __fill_.__get(); } template <class _CharT, class _Traits> inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) { - if (traits_type::eq_int_type(traits_type::eof(), __fill_)) + if (!__fill_.__is_set()) __fill_ = widen(' '); - char_type __r = __fill_; + char_type __r = __fill_.__get(); __fill_ = __ch; return __r; } template <class _CharT, class _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) { - if (this != &__rhs) { + if (this != std::addressof(__rhs)) { __call_callbacks(erase_event); ios_base::copyfmt(__rhs); __tie_ = __rhs.__tie_; @@ -704,9 +741,9 @@ inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_st extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>; -#endif +# endif _LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) { __str.setf(ios_base::boolalpha); @@ -832,6 +869,8 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/iosfwd b/contrib/libs/cxxsupp/libcxx/include/iosfwd index 051c73995e9..eeafcc37c59 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iosfwd +++ b/contrib/libs/cxxsupp/libcxx/include/iosfwd @@ -170,8 +170,8 @@ class __save_flags { _CharT __fill_; public: - __save_flags(const __save_flags&) = delete; - __save_flags& operator=(const __save_flags&) = delete; + __save_flags(const __save_flags&) = delete; + __save_flags& operator=(const __save_flags&) = delete; _LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream) : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {} diff --git a/contrib/libs/cxxsupp/libcxx/include/istream b/contrib/libs/cxxsupp/libcxx/include/istream index d2b577a9ad9..8ee29ba3302 100644 --- a/contrib/libs/cxxsupp/libcxx/include/istream +++ b/contrib/libs/cxxsupp/libcxx/include/istream @@ -159,25 +159,29 @@ template <class Stream, class T> */ #include <__config> -#include <__fwd/istream.h> -#include <__iterator/istreambuf_iterator.h> -#include <__ostream/basic_ostream.h> -#include <__type_traits/conjunction.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_base_of.h> -#include <__utility/declval.h> -#include <__utility/forward.h> -#include <bitset> -#include <ios> -#include <locale> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__fwd/istream.h> +# include <__iterator/istreambuf_iterator.h> +# include <__ostream/basic_ostream.h> +# include <__type_traits/conjunction.h> +# include <__type_traits/enable_if.h> +# include <__type_traits/is_base_of.h> +# include <__type_traits/make_unsigned.h> +# include <__utility/declval.h> +# include <__utility/forward.h> +# include <bitset> +# include <ios> +# include <locale> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -353,13 +357,13 @@ __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -367,7 +371,7 @@ __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { throw; } } -#endif +# endif __is.setstate(__state); } return __is; @@ -434,9 +438,9 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; long __temp; @@ -450,7 +454,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp } else { __n = static_cast<_Tp>(__temp); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -458,7 +462,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __is.setstate(__state); } return __is; @@ -480,9 +484,9 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif _CharT* __s = __p; const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); while (__s != __p + (__n - 1)) { @@ -501,7 +505,7 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) __is.width(0); if (__s == __p) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -509,13 +513,13 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) throw; } } -#endif +# endif __is.setstate(__state); } return __is; } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits, size_t _Np> inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& @@ -538,7 +542,7 @@ operator>>(basic_istream<char, _Traits>& __is, signed char (&__buf)[_Np]) { return __is >> (char(&)[_Np])__buf; } -#else +# else template <class _CharT, class _Traits> inline _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& @@ -561,22 +565,22 @@ operator>>(basic_istream<char, _Traits>& __is, signed char* __s) { return __is >> (char*)__s; } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__i, _Traits::eof())) __state |= ios_base::eofbit | ios_base::failbit; else __c = _Traits::to_char_type(__i); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -584,7 +588,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_ throw; } } -#endif +# endif __is.setstate(__state); } return __is; @@ -610,9 +614,9 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ sentry __s(*this, true); if (__s) { if (__sb) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, _Traits::eof())) { @@ -626,7 +630,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ } if (__gc_ == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; if (__gc_ == 0) @@ -637,7 +641,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { __state |= ios_base::failbit; } @@ -653,22 +657,22 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits> int_type __r = traits_type::eof(); sentry __s(*this, true); if (__s) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif __r = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__r, traits_type::eof())) __state |= ios_base::failbit | ios_base::eofbit; else __gc_ = 1; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__setstate_nothrow(this->rdstate() | ios_base::badbit); if (this->exceptions() & ios_base::badbit) { throw; } } -#endif +# endif this->setstate(__state); } return __r; @@ -681,9 +685,9 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* _ sentry __sen(*this, true); if (__sen) { if (__n > 0) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif while (__gc_ < __n - 1) { int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { @@ -699,7 +703,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* _ } if (__gc_ == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -709,7 +713,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* _ throw; } } -#endif +# endif } else { __state |= ios_base::failbit; } @@ -730,9 +734,9 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s __gc_ = 0; sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { @@ -747,12 +751,12 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s __inc_gcount(); this->rdbuf()->sbumpc(); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; // according to the spec, exceptions here are caught but not rethrown } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__gc_ == 0) __state |= ios_base::failbit; this->setstate(__state); @@ -767,9 +771,9 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ __gc_ = 0; sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { @@ -790,7 +794,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ this->rdbuf()->sbumpc(); __inc_gcount(); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -802,7 +806,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } if (__n > 0) *__s = char_type(); @@ -818,9 +822,9 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz __gc_ = 0; sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__n == numeric_limits<streamsize>::max()) { while (true) { typename traits_type::int_type __i = this->rdbuf()->sbumpc(); @@ -844,7 +848,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz break; } } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -852,7 +856,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -865,13 +869,13 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits> int_type __r = traits_type::eof(); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __r = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__r, traits_type::eof())) __state |= ios_base::eofbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -879,7 +883,7 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits> throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -891,13 +895,13 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* __gc_ = 0; sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __gc_ = this->rdbuf()->sgetn(__s, __n); if (__gc_ != __n) __state |= ios_base::failbit | ios_base::eofbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -905,7 +909,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { __state |= ios_base::failbit; } @@ -919,9 +923,9 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _ __gc_ = 0; sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS streamsize __c = this->rdbuf()->in_avail(); switch (__c) { case -1: @@ -936,7 +940,7 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _ __state |= ios_base::failbit | ios_base::eofbit; break; } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -944,7 +948,7 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { __state |= ios_base::failbit; } @@ -959,12 +963,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_typ this->clear(__state); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof()) __state |= ios_base::badbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -972,7 +976,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_typ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { __state |= ios_base::failbit; } @@ -987,12 +991,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { this->clear(__state); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof()) __state |= ios_base::badbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -1000,7 +1004,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { __state |= ios_base::failbit; } @@ -1017,14 +1021,14 @@ int basic_istream<_CharT, _Traits>::sync() { int __r = 0; if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()->pubsync() == -1) { __state |= ios_base::badbit; __r = -1; } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -1032,7 +1036,7 @@ int basic_istream<_CharT, _Traits>::sync() { throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -1044,11 +1048,11 @@ typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits> pos_type __r(-1); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -1056,7 +1060,7 @@ typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits> throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -1068,12 +1072,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type _ this->clear(__state); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -1081,7 +1085,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type _ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -1093,12 +1097,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type _ this->clear(__state); sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; this->__setstate_nothrow(__state); @@ -1106,7 +1110,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type _ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -1117,9 +1121,9 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _ ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); while (true) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); @@ -1131,7 +1135,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _ break; __is.rdbuf()->sbumpc(); } -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -1139,7 +1143,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _ throw; } } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __is.setstate(__state); } return __is; @@ -1207,16 +1211,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _ ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif __str.clear(); - streamsize __n = __is.width(); - if (__n <= 0) - __n = __str.max_size(); - if (__n <= 0) - __n = numeric_limits<streamsize>::max(); - streamsize __c = 0; + using _Size = typename basic_string<_CharT, _Traits, _Allocator>::size_type; + streamsize const __width = __is.width(); + _Size const __max_size = __str.max_size(); + _Size __n; + if (__width <= 0) { + __n = __max_size; + } else { + __n = std::__to_unsigned_like(__width) < __max_size ? static_cast<_Size>(__width) : __max_size; + } + + _Size __c = 0; const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); while (__c < __n) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); @@ -1234,7 +1243,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _ __is.width(0); if (__c == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -1242,7 +1251,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _ throw; } } -#endif +# endif __is.setstate(__state); } return __is; @@ -1254,9 +1263,9 @@ getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _All ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif __str.clear(); streamsize __extr = 0; while (true) { @@ -1277,7 +1286,7 @@ getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _All } if (__extr == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -1285,7 +1294,7 @@ getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _All throw; } } -#endif +# endif __is.setstate(__state); } return __is; @@ -1315,9 +1324,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif +# endif basic_string<_CharT, _Traits> __str; const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); size_t __c = 0; @@ -1339,7 +1348,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) { __x = bitset<_Size>(__str); if (_Size > 0 && __c == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; __is.__setstate_nothrow(__state); @@ -1347,20 +1356,22 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) { throw; } } -#endif +# endif __is.setstate(__state); } return __is; } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>; -#endif +# endif extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>; _LIBCPP_END_NAMESPACE_STD +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/iterator b/contrib/libs/cxxsupp/libcxx/include/iterator index 1b9e7eaf0c1..fca75f0a19e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/iterator @@ -683,43 +683,49 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; #include <__iterator/access.h> #include <__iterator/advance.h> #include <__iterator/back_insert_iterator.h> -#include <__iterator/bounded_iter.h> -#include <__iterator/common_iterator.h> -#include <__iterator/concepts.h> -#include <__iterator/counted_iterator.h> -#include <__iterator/data.h> -#include <__iterator/default_sentinel.h> #include <__iterator/distance.h> -#include <__iterator/empty.h> -#include <__iterator/erase_if_container.h> #include <__iterator/front_insert_iterator.h> -#include <__iterator/incrementable_traits.h> -#include <__iterator/indirectly_comparable.h> #include <__iterator/insert_iterator.h> #include <__iterator/istream_iterator.h> #include <__iterator/istreambuf_iterator.h> -#include <__iterator/iter_move.h> -#include <__iterator/iter_swap.h> #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> -#include <__iterator/mergeable.h> #include <__iterator/move_iterator.h> -#include <__iterator/move_sentinel.h> #include <__iterator/next.h> #include <__iterator/ostream_iterator.h> #include <__iterator/ostreambuf_iterator.h> -#include <__iterator/permutable.h> #include <__iterator/prev.h> -#include <__iterator/projected.h> -#include <__iterator/readable_traits.h> -#include <__iterator/reverse_access.h> #include <__iterator/reverse_iterator.h> -#include <__iterator/size.h> -#include <__iterator/sortable.h> -#include <__iterator/unreachable_sentinel.h> #include <__iterator/wrap_iter.h> -#include <__memory/addressof.h> -#include <__memory/pointer_traits.h> + +#if _LIBCPP_STD_VER >= 14 +# include <__iterator/reverse_access.h> +#endif + +#if _LIBCPP_STD_VER >= 17 +# include <__iterator/data.h> +# include <__iterator/empty.h> +# include <__iterator/size.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__iterator/common_iterator.h> +# include <__iterator/concepts.h> +# include <__iterator/counted_iterator.h> +# include <__iterator/default_sentinel.h> +# include <__iterator/incrementable_traits.h> +# include <__iterator/indirectly_comparable.h> +# include <__iterator/iter_move.h> +# include <__iterator/iter_swap.h> +# include <__iterator/mergeable.h> +# include <__iterator/move_sentinel.h> +# include <__iterator/permutable.h> +# include <__iterator/projected.h> +# include <__iterator/readable_traits.h> +# include <__iterator/sortable.h> +# include <__iterator/unreachable_sentinel.h> +#endif + #include <version> // standard-mandated includes @@ -732,6 +738,10 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include <variant> +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdlib> # include <exception> diff --git a/contrib/libs/cxxsupp/libcxx/include/latch b/contrib/libs/cxxsupp/libcxx/include/latch index da8dae149c7..b56e49bc768 100644 --- a/contrib/libs/cxxsupp/libcxx/include/latch +++ b/contrib/libs/cxxsupp/libcxx/include/latch @@ -16,7 +16,7 @@ namespace std { - class latch + class latch // since C++20 { public: static constexpr ptrdiff_t max() noexcept; @@ -42,30 +42,28 @@ namespace std #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<latch> is not supported since libc++ has been configured without support for threads." -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) -#include <__assert> -#include <__atomic/atomic_base.h> -#include <__atomic/atomic_sync.h> -#include <__atomic/memory_order.h> -#include <cstddef> -#include <limits> -#include <version> +# include <__assert> +# include <__atomic/atomic_base.h> +# include <__atomic/atomic_sync.h> +# include <__atomic/memory_order.h> +# include <cstddef> +# include <limits> +# include <version> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> -#if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD -class _LIBCPP_DEPRECATED_ATOMIC_SYNC latch { +class latch { __atomic_base<ptrdiff_t> __a_; public: @@ -118,12 +116,14 @@ private: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> #endif -#endif //_LIBCPP_LATCH +#endif // _LIBCPP_LATCH diff --git a/contrib/libs/cxxsupp/libcxx/include/limits b/contrib/libs/cxxsupp/libcxx/include/limits index d55c7cd75f3..b85c66257d2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/limits +++ b/contrib/libs/cxxsupp/libcxx/include/limits @@ -137,9 +137,9 @@ protected: typedef _Tp type; static _LIBCPP_CONSTEXPR const bool is_specialized = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); } static _LIBCPP_CONSTEXPR const int digits = 0; static _LIBCPP_CONSTEXPR const int digits10 = 0; @@ -148,8 +148,8 @@ protected: static _LIBCPP_CONSTEXPR const bool is_integer = false; static _LIBCPP_CONSTEXPR const bool is_exact = false; static _LIBCPP_CONSTEXPR const int radix = 0; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(); } static _LIBCPP_CONSTEXPR const int min_exponent = 0; static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; @@ -161,10 +161,10 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(); } static _LIBCPP_CONSTEXPR const bool is_iec559 = false; static _LIBCPP_CONSTEXPR const bool is_bounded = false; @@ -198,15 +198,15 @@ protected: static _LIBCPP_CONSTEXPR const int max_digits10 = 0; static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value; static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); } static _LIBCPP_CONSTEXPR const bool is_integer = true; static _LIBCPP_CONSTEXPR const bool is_exact = true; static _LIBCPP_CONSTEXPR const int radix = 2; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); } static _LIBCPP_CONSTEXPR const int min_exponent = 0; static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; @@ -218,10 +218,10 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); } static _LIBCPP_CONSTEXPR const bool is_iec559 = false; static _LIBCPP_CONSTEXPR const bool is_bounded = true; @@ -249,15 +249,15 @@ protected: static _LIBCPP_CONSTEXPR const int max_digits10 = 0; static _LIBCPP_CONSTEXPR const type __min = false; static _LIBCPP_CONSTEXPR const type __max = true; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __min; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __max; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return min(); } static _LIBCPP_CONSTEXPR const bool is_integer = true; static _LIBCPP_CONSTEXPR const bool is_exact = true; static _LIBCPP_CONSTEXPR const int radix = 2; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return type(0); } static _LIBCPP_CONSTEXPR const int min_exponent = 0; static _LIBCPP_CONSTEXPR const int min_exponent10 = 0; @@ -269,10 +269,10 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return type(0); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return type(0); } static _LIBCPP_CONSTEXPR const bool is_iec559 = false; static _LIBCPP_CONSTEXPR const bool is_bounded = true; @@ -294,15 +294,15 @@ protected: static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__; static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__; static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __FLT_MIN__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __FLT_MAX__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __FLT_MIN__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __FLT_MAX__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } static _LIBCPP_CONSTEXPR const bool is_integer = false; static _LIBCPP_CONSTEXPR const bool is_exact = false; static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __FLT_EPSILON__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5F; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __FLT_EPSILON__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5F; } static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__; static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__; @@ -314,16 +314,16 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_valf(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanf(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansf(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __FLT_DENORM_MIN__; } @@ -351,15 +351,15 @@ protected: static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__; static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__; static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __DBL_MIN__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __DBL_MAX__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __DBL_MIN__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __DBL_MAX__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } static _LIBCPP_CONSTEXPR const bool is_integer = false; static _LIBCPP_CONSTEXPR const bool is_exact = false; static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __DBL_EPSILON__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __DBL_EPSILON__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5; } static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__; static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__; @@ -371,16 +371,16 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_val(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nan(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nans(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __DBL_DENORM_MIN__; } @@ -408,15 +408,15 @@ protected: static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__; static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__; static _LIBCPP_CONSTEXPR const int max_digits10 = 2 + (digits * 30103l) / 100000l; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __LDBL_MIN__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __LDBL_MAX__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __LDBL_MIN__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __LDBL_MAX__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return -max(); } static _LIBCPP_CONSTEXPR const bool is_integer = false; static _LIBCPP_CONSTEXPR const bool is_exact = false; static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5L; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __LDBL_EPSILON__; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return 0.5L; } static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__; static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__; @@ -428,16 +428,16 @@ protected: static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_vall(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanl(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansl(""); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __LDBL_DENORM_MIN__; } @@ -465,9 +465,9 @@ class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp> public: static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } static _LIBCPP_CONSTEXPR const int digits = __base::digits; static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; @@ -476,10 +476,10 @@ public: static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; static _LIBCPP_CONSTEXPR const int radix = __base::radix; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); } @@ -495,16 +495,16 @@ public: static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; _LIBCPP_SUPPRESS_DEPRECATED_POP - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index 929c84de7be..05234f7696c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -225,6 +225,7 @@ template <class T, class Allocator, class Predicate> #include <__ranges/container_compatible_range.h> #include <__ranges/from_range.h> #include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_nothrow_assignable.h> #include <__type_traits/is_nothrow_constructible.h> @@ -271,19 +272,21 @@ struct __list_node_pointer_traits { typedef __rebind_pointer_t<_VoidPtr, __list_node<_Tp, _VoidPtr> > __node_pointer; typedef __rebind_pointer_t<_VoidPtr, __list_node_base<_Tp, _VoidPtr> > __base_pointer; -#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB) - typedef __base_pointer __link_pointer; -#else - typedef __conditional_t<is_pointer<_VoidPtr>::value, __base_pointer, __node_pointer> __link_pointer; +// TODO(LLVM 22): Remove this check +#ifndef _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB + static_assert(sizeof(__node_pointer) == sizeof(__node_pointer) && _LIBCPP_ALIGNOF(__base_pointer) == + _LIBCPP_ALIGNOF(__node_pointer), + "It looks like you are using std::list with a fancy pointer type that thas a different representation " + "depending on whether it points to a list base pointer or a list node pointer (both of which are " + "implementation details of the standard library). This means that your ABI is being broken between " + "LLVM 19 and LLVM 20. If you don't care about your ABI being broken, define the " + "_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB macro to silence this diagnostic."); #endif - typedef __conditional_t<is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer> - __non_link_pointer; - - static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { return __p; } + static _LIBCPP_HIDE_FROM_ABI __base_pointer __unsafe_link_pointer_cast(__base_pointer __p) { return __p; } - static _LIBCPP_HIDE_FROM_ABI __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) { - return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p)); + static _LIBCPP_HIDE_FROM_ABI __base_pointer __unsafe_link_pointer_cast(__node_pointer __p) { + return static_cast<__base_pointer>(static_cast<_VoidPtr>(__p)); } }; @@ -292,16 +295,13 @@ struct __list_node_base { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; typedef typename _NodeTraits::__node_pointer __node_pointer; typedef typename _NodeTraits::__base_pointer __base_pointer; - typedef typename _NodeTraits::__link_pointer __link_pointer; - __link_pointer __prev_; - __link_pointer __next_; + __base_pointer __prev_; + __base_pointer __next_; - _LIBCPP_HIDE_FROM_ABI __list_node_base() - : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())), - __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {} + _LIBCPP_HIDE_FROM_ABI __list_node_base() : __prev_(__self()), __next_(__self()) {} - _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__link_pointer __prev, __link_pointer __next) + _LIBCPP_HIDE_FROM_ABI explicit __list_node_base(__base_pointer __prev, __base_pointer __next) : __prev_(__prev), __next_(__next) {} _LIBCPP_HIDE_FROM_ABI __base_pointer __self() { return pointer_traits<__base_pointer>::pointer_to(*this); } @@ -332,12 +332,12 @@ public: #endif typedef __list_node_base<_Tp, _VoidPtr> __base; - typedef typename __base::__link_pointer __link_pointer; + typedef typename __base::__base_pointer __base_pointer; - _LIBCPP_HIDE_FROM_ABI explicit __list_node(__link_pointer __prev, __link_pointer __next) : __base(__prev, __next) {} + _LIBCPP_HIDE_FROM_ABI explicit __list_node(__base_pointer __prev, __base_pointer __next) : __base(__prev, __next) {} _LIBCPP_HIDE_FROM_ABI ~__list_node() {} - _LIBCPP_HIDE_FROM_ABI __link_pointer __as_link() { return static_cast<__link_pointer>(__base::__self()); } + _LIBCPP_HIDE_FROM_ABI __base_pointer __as_link() { return __base::__self(); } }; template <class _Tp, class _Alloc = allocator<_Tp> > @@ -350,11 +350,11 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator; template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_iterator { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; - typedef typename _NodeTraits::__link_pointer __link_pointer; + typedef typename _NodeTraits::__base_pointer __base_pointer; - __link_pointer __ptr_; + __base_pointer __ptr_; - _LIBCPP_HIDE_FROM_ABI explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} + _LIBCPP_HIDE_FROM_ABI explicit __list_iterator(__base_pointer __p) _NOEXCEPT : __ptr_(__p) {} template <class, class> friend class list; @@ -408,11 +408,11 @@ public: template <class _Tp, class _VoidPtr> class _LIBCPP_TEMPLATE_VIS __list_const_iterator { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; - typedef typename _NodeTraits::__link_pointer __link_pointer; + typedef typename _NodeTraits::__base_pointer __base_pointer; - __link_pointer __ptr_; + __base_pointer __ptr_; - _LIBCPP_HIDE_FROM_ABI explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} + _LIBCPP_HIDE_FROM_ABI explicit __list_const_iterator(__base_pointer __p) _NOEXCEPT : __ptr_(__p) {} template <class, class> friend class list; @@ -466,7 +466,7 @@ public: template <class _Tp, class _Alloc> class __list_imp { public: - __list_imp(const __list_imp&) = delete; + __list_imp(const __list_imp&) = delete; __list_imp& operator=(const __list_imp&) = delete; typedef _Alloc allocator_type; @@ -485,8 +485,8 @@ protected: typedef typename __node_alloc_traits::pointer __node_pointer; typedef typename __node_alloc_traits::pointer __node_const_pointer; typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits; - typedef typename __node_pointer_traits::__link_pointer __link_pointer; - typedef __link_pointer __link_const_pointer; + typedef typename __node_pointer_traits::__base_pointer __base_pointer; + typedef __base_pointer __link_const_pointer; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::difference_type difference_type; @@ -497,21 +497,21 @@ protected: "internal allocator type must differ from user-specified type; otherwise overload resolution breaks"); __node_base __end_; - __compressed_pair<size_type, __node_allocator> __size_alloc_; + _LIBCPP_COMPRESSED_PAIR(size_type, __size_, __node_allocator, __node_alloc_); - _LIBCPP_HIDE_FROM_ABI __link_pointer __end_as_link() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI __base_pointer __end_as_link() const _NOEXCEPT { return __node_pointer_traits::__unsafe_link_pointer_cast(const_cast<__node_base&>(__end_).__self()); } - _LIBCPP_HIDE_FROM_ABI size_type& __sz() _NOEXCEPT { return __size_alloc_.first(); } - _LIBCPP_HIDE_FROM_ABI const size_type& __sz() const _NOEXCEPT { return __size_alloc_.first(); } - _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __size_alloc_.second(); } - _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __size_alloc_.second(); } + _LIBCPP_HIDE_FROM_ABI size_type& __sz() _NOEXCEPT { return __size_; } + _LIBCPP_HIDE_FROM_ABI const size_type& __sz() const _NOEXCEPT { return __size_; } + _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; } + _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; } _LIBCPP_HIDE_FROM_ABI size_type __node_alloc_max_size() const _NOEXCEPT { return __node_alloc_traits::max_size(__node_alloc()); } - _LIBCPP_HIDE_FROM_ABI static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI static void __unlink_nodes(__base_pointer __f, __base_pointer __l) _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI __list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value); _LIBCPP_HIDE_FROM_ABI __list_imp(const allocator_type& __a); @@ -548,7 +548,7 @@ protected: } template <class... _Args> - _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__link_pointer __prev, __link_pointer __next, _Args&&... __args) { + _LIBCPP_HIDE_FROM_ABI __node_pointer __create_node(__base_pointer __prev, __base_pointer __next, _Args&&... __args) { __node_allocator& __alloc = __node_alloc(); __allocation_guard<__node_allocator> __guard(__alloc, 1); // Begin the lifetime of the node itself. Note that this doesn't begin the lifetime of the value @@ -593,24 +593,27 @@ private: // Unlink nodes [__f, __l] template <class _Tp, class _Alloc> -inline void __list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT { +inline void __list_imp<_Tp, _Alloc>::__unlink_nodes(__base_pointer __f, __base_pointer __l) _NOEXCEPT { __f->__prev_->__next_ = __l->__next_; __l->__next_->__prev_ = __f->__prev_; } template <class _Tp, class _Alloc> inline __list_imp<_Tp, _Alloc>::__list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) - : __size_alloc_(0, __default_init_tag()) {} + : __size_(0) {} template <class _Tp, class _Alloc> -inline __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) : __size_alloc_(0, __node_allocator(__a)) {} +inline __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) + : __size_(0), __node_alloc_(__node_allocator(__a)) {} template <class _Tp, class _Alloc> -inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_alloc_(0, __a) {} +inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_(0), __node_alloc_(__a) {} #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Alloc> -inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT : __size_alloc_(0, std::move(__a)) {} +inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT + : __size_(0), + __node_alloc_(std::move(__a)) {} #endif template <class _Tp, class _Alloc> @@ -621,8 +624,8 @@ __list_imp<_Tp, _Alloc>::~__list_imp() { template <class _Tp, class _Alloc> void __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT { if (!empty()) { - __link_pointer __f = __end_.__next_; - __link_pointer __l = __end_as_link(); + __base_pointer __f = __end_.__next_; + __base_pointer __l = __end_as_link(); __unlink_nodes(__f, __l->__prev_); __sz() = 0; while (__f != __l) { @@ -668,7 +671,7 @@ class _LIBCPP_TEMPLATE_VIS list : private __list_imp<_Tp, _Alloc> { typedef typename base::__node_alloc_traits __node_alloc_traits; typedef typename base::__node_base __node_base; typedef typename base::__node_base_pointer __node_base_pointer; - typedef typename base::__link_pointer __link_pointer; + typedef typename base::__base_pointer __base_pointer; public: typedef _Tp value_type; @@ -754,7 +757,7 @@ public: _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return base::__sz(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return base::empty(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return base::empty(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return std::min<size_type>(base::__node_alloc_max_size(), numeric_limits<difference_type >::max()); } @@ -917,9 +920,9 @@ private: template <class _Iterator, class _Sentinel> _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l); - _LIBCPP_HIDE_FROM_ABI static void __link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l); - _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_front(__link_pointer __f, __link_pointer __l); - _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_back(__link_pointer __f, __link_pointer __l); + _LIBCPP_HIDE_FROM_ABI static void __link_nodes(__base_pointer __p, __base_pointer __f, __base_pointer __l); + _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_front(__base_pointer __f, __base_pointer __l); + _LIBCPP_HIDE_FROM_ABI void __link_nodes_at_back(__base_pointer __f, __base_pointer __l); _LIBCPP_HIDE_FROM_ABI iterator __iterator(size_type __n); // TODO: Make this _LIBCPP_HIDE_FROM_ABI template <class _Comp> @@ -953,7 +956,7 @@ list(from_range_t, _Range&&, _Alloc = _Alloc()) -> list<ranges::range_value_t<_R // Link in nodes [__f, __l] just prior to __p template <class _Tp, class _Alloc> -inline void list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) { +inline void list<_Tp, _Alloc>::__link_nodes(__base_pointer __p, __base_pointer __f, __base_pointer __l) { __p->__prev_->__next_ = __f; __f->__prev_ = __p->__prev_; __p->__prev_ = __l; @@ -962,7 +965,7 @@ inline void list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer _ // Link in nodes [__f, __l] at the front of the list template <class _Tp, class _Alloc> -inline void list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) { +inline void list<_Tp, _Alloc>::__link_nodes_at_front(__base_pointer __f, __base_pointer __l) { __f->__prev_ = base::__end_as_link(); __l->__next_ = base::__end_.__next_; __l->__next_->__prev_ = __l; @@ -971,7 +974,7 @@ inline void list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_ // Link in nodes [__f, __l] at the back of the list template <class _Tp, class _Alloc> -inline void list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) { +inline void list<_Tp, _Alloc>::__link_nodes_at_back(__base_pointer __f, __base_pointer __l) { __l->__next_ = base::__end_as_link(); __f->__prev_ = base::__end_.__prev_; __f->__prev_->__next_ = __f; @@ -1163,7 +1166,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { while (true) { - __link_pointer __prev = __e.__ptr_->__prev_; + __base_pointer __prev = __e.__ptr_->__prev_; __node_pointer __current = __e.__ptr_->__as_node(); this->__delete_node(__current); if (__prev == 0) @@ -1205,7 +1208,7 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { while (true) { - __link_pointer __prev = __e.__ptr_->__prev_; + __base_pointer __prev = __e.__ptr_->__prev_; __node_pointer __current = __e.__ptr_->__as_node(); this->__delete_node(__current); if (__prev == 0) @@ -1224,7 +1227,7 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_front(const value_type& __x) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_front(__nl, __nl); ++base::__sz(); } @@ -1232,7 +1235,7 @@ void list<_Tp, _Alloc>::push_front(const value_type& __x) { template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_back(const value_type& __x) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_back(__nl, __nl); ++base::__sz(); } @@ -1242,7 +1245,7 @@ void list<_Tp, _Alloc>::push_back(const value_type& __x) { template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_front(value_type&& __x) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x)); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_front(__nl, __nl); ++base::__sz(); } @@ -1250,7 +1253,7 @@ void list<_Tp, _Alloc>::push_front(value_type&& __x) { template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_back(value_type&& __x) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x)); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_back(__nl, __nl); ++base::__sz(); } @@ -1265,7 +1268,7 @@ void list<_Tp, _Alloc>::emplace_front(_Args&&... __args) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_front(__nl, __nl); ++base::__sz(); # if _LIBCPP_STD_VER >= 17 @@ -1283,7 +1286,7 @@ void list<_Tp, _Alloc>::emplace_back(_Args&&... __args) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes_at_back(__nl, __nl); ++base::__sz(); # if _LIBCPP_STD_VER >= 17 @@ -1296,7 +1299,7 @@ template <class... _Args> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::forward<_Args>(__args)...); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); return iterator(__nl); @@ -1305,7 +1308,7 @@ typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator _ template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) { __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, std::move(__x)); - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); return iterator(__nl); @@ -1316,7 +1319,7 @@ typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __ template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::pop_front() { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_front() called with empty list"); - __link_pointer __n = base::__end_.__next_; + __base_pointer __n = base::__end_.__next_; base::__unlink_nodes(__n, __n); --base::__sz(); this->__delete_node(__n->__as_node()); @@ -1325,7 +1328,7 @@ void list<_Tp, _Alloc>::pop_front() { template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::pop_back() { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "list::pop_back() called on an empty list"); - __link_pointer __n = base::__end_.__prev_; + __base_pointer __n = base::__end_.__prev_; base::__unlink_nodes(__n, __n); --base::__sz(); this->__delete_node(__n->__as_node()); @@ -1334,8 +1337,8 @@ void list<_Tp, _Alloc>::pop_back() { template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __p) { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__p != end(), "list::erase(iterator) called with a non-dereferenceable iterator"); - __link_pointer __n = __p.__ptr_; - __link_pointer __r = __n->__next_; + __base_pointer __n = __p.__ptr_; + __base_pointer __r = __n->__next_; base::__unlink_nodes(__n, __n); --base::__sz(); this->__delete_node(__n->__as_node()); @@ -1347,7 +1350,7 @@ typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __f if (__f != __l) { base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_); while (__f != __l) { - __link_pointer __n = __f.__ptr_; + __base_pointer __n = __f.__ptr_; ++__f; --base::__sz(); this->__delete_node(__n->__as_node()); @@ -1376,7 +1379,7 @@ void list<_Tp, _Alloc>::resize(size_type __n) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { while (true) { - __link_pointer __prev = __e.__ptr_->__prev_; + __base_pointer __prev = __e.__ptr_->__prev_; __node_pointer __current = __e.__ptr_->__as_node(); this->__delete_node(__current); if (__prev == 0) @@ -1400,7 +1403,7 @@ void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) { size_type __ds = 0; __node_pointer __node = this->__create_node(/* prev = */ nullptr, /* next = */ nullptr, __x); ++__ds; - __link_pointer __nl = __node->__as_link(); + __base_pointer __nl = __node->__as_link(); iterator __r = iterator(__nl); iterator __e = __r; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS @@ -1412,7 +1415,7 @@ void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { while (true) { - __link_pointer __prev = __e.__ptr_->__prev_; + __base_pointer __prev = __e.__ptr_->__prev_; __node_pointer __current = __e.__ptr_->__as_node(); this->__delete_node(__current); if (__prev == 0) @@ -1432,8 +1435,8 @@ void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) { _LIBCPP_ASSERT_VALID_INPUT_RANGE( this != std::addressof(__c), "list::splice(iterator, list) called with this == &list"); if (!__c.empty()) { - __link_pointer __f = __c.__end_.__next_; - __link_pointer __l = __c.__end_.__prev_; + __base_pointer __f = __c.__end_.__next_; + __base_pointer __l = __c.__end_.__prev_; base::__unlink_nodes(__f, __l); __link_nodes(__p.__ptr_, __f, __l); base::__sz() += __c.__sz(); @@ -1444,7 +1447,7 @@ void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) { template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) { if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) { - __link_pointer __f = __i.__ptr_; + __base_pointer __f = __i.__ptr_; base::__unlink_nodes(__f, __f); __link_nodes(__p.__ptr_, __f, __f); --__c.__sz(); @@ -1455,9 +1458,9 @@ void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) { if (__f != __l) { - __link_pointer __first = __f.__ptr_; + __base_pointer __first = __f.__ptr_; --__l; - __link_pointer __last = __l.__ptr_; + __base_pointer __last = __l.__ptr_; if (this != std::addressof(__c)) { size_type __s = std::distance(__f, __l) + 1; __c.__sz() -= __s; @@ -1545,8 +1548,8 @@ void list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) { ; base::__sz() += __ds; __c.__sz() -= __ds; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; + __base_pointer __f = __f2.__ptr_; + __base_pointer __l = __m2.__ptr_->__prev_; __f2 = __m2; base::__unlink_nodes(__f, __l); __m2 = std::next(__f1); @@ -1580,7 +1583,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __ return __f1; case 2: if (__comp(*--__e2, *__f1)) { - __link_pointer __f = __e2.__ptr_; + __base_pointer __f = __e2.__ptr_; base::__unlink_nodes(__f, __f); __link_nodes(__f1.__ptr_, __f, __f); return __e2; @@ -1595,8 +1598,8 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __ iterator __m2 = std::next(__f2); for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) ; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; + __base_pointer __f = __f2.__ptr_; + __base_pointer __l = __m2.__ptr_->__prev_; __r = __f2; __e1 = __f2 = __m2; base::__unlink_nodes(__f, __l); @@ -1610,8 +1613,8 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __ iterator __m2 = std::next(__f2); for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) ; - __link_pointer __f = __f2.__ptr_; - __link_pointer __l = __m2.__ptr_->__prev_; + __base_pointer __f = __f2.__ptr_; + __base_pointer __l = __m2.__ptr_->__prev_; if (__e1 == __f2) __e1 = __m2; __f2 = __m2; @@ -1679,8 +1682,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const list<_Tp, _Alloc>& __x, const template <class _Tp, class _Allocator> _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index 0b2ac488e19..4a3df88d282 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -187,67 +187,74 @@ template <class charT> class messages_byname; */ -#include <__algorithm/copy.h> -#include <__algorithm/equal.h> -#include <__algorithm/find.h> -#include <__algorithm/max.h> -#include <__algorithm/reverse.h> -#include <__algorithm/unwrap_iter.h> -#include <__assert> #include <__config> -#include <__iterator/access.h> -#include <__iterator/back_insert_iterator.h> -#include <__iterator/istreambuf_iterator.h> -#include <__iterator/ostreambuf_iterator.h> -#include <__locale> -#include <__memory/unique_ptr.h> -#include <__type_traits/make_unsigned.h> -#include <cerrno> -#include <cstdio> -#include <cstdlib> -#include <ctime> -#include <ios> -#include <limits> -#include <new> -#include <streambuf> -#include <version> + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__algorithm/copy.h> +# include <__algorithm/equal.h> +# include <__algorithm/find.h> +# include <__algorithm/max.h> +# include <__algorithm/reverse.h> +# include <__algorithm/unwrap_iter.h> +# include <__assert> +# include <__iterator/access.h> +# include <__iterator/back_insert_iterator.h> +# include <__iterator/istreambuf_iterator.h> +# include <__iterator/ostreambuf_iterator.h> +# include <__locale> +# include <__memory/unique_ptr.h> +# include <__type_traits/make_unsigned.h> +# include <cerrno> +# include <cstdio> +# include <cstdlib> +# include <ctime> +# include <ios> +# include <limits> +# include <new> +# include <streambuf> +# include <version> // TODO: Fix __bsd_locale_defaults.h // NOLINTBEGIN(libcpp-robust-against-adl) -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. -# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) -# define _LIBCPP_HAS_CATOPEN 1 -# include <nl_types.h> +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) +# define _LIBCPP_HAS_CATOPEN 1 +# include <nl_types.h> +# endif # endif -#endif -#ifdef _LIBCPP_LOCALE__L_EXTENSIONS -# include <__locale_dir/locale_base_api/bsd_locale_defaults.h> -#else -# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h> -#endif +# ifdef _LIBCPP_LOCALE__L_EXTENSIONS +# include <__locale_dir/locale_base_api/bsd_locale_defaults.h> +# else +# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h> +# endif -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if defined(__APPLE__) || defined(__FreeBSD__) +# include <xlocale.h> +# endif + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(__APPLE__) || defined(__FreeBSD__) -# define _LIBCPP_GET_C_LOCALE 0 -#elif defined(__NetBSD__) -# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE -#else -# define _LIBCPP_GET_C_LOCALE __cloc() +# if defined(__APPLE__) || defined(__FreeBSD__) +# define _LIBCPP_GET_C_LOCALE 0 +# elif defined(__NetBSD__) +# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE +# else +# define _LIBCPP_GET_C_LOCALE __cloc() // Get the C locale object _LIBCPP_EXPORTED_FROM_ABI locale_t __cloc(); -# define __cloc_defined -#endif +# define __cloc_defined +# endif // __scan_keyword // Scans [__b, __e) until a match is found in the basic_strings range @@ -395,7 +402,7 @@ struct __num_get : protected __num_get_base { unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); -#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); static int __stage2_int_loop( _CharT __ct, @@ -409,7 +416,7 @@ struct __num_get : protected __num_get_base { unsigned*& __g_end, _CharT* __atoms); -#else +# else static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); @@ -444,10 +451,10 @@ private: (void)__atoms; return __src; } -#endif +# endif }; -#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET template <class _CharT> string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); @@ -456,7 +463,7 @@ string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _C __thousands_sep = __np.thousands_sep(); return __np.grouping(); } -#endif +# endif template <class _CharT> string __num_get<_CharT>::__stage2_float_prep( @@ -471,16 +478,16 @@ string __num_get<_CharT>::__stage2_float_prep( template <class _CharT> int -#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, _CharT* __atoms) -#else +# else __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) -#endif +# endif { if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) { *__a_end++ = __ct == __atoms[24] ? '+' : '-'; @@ -579,9 +586,9 @@ int __num_get<_CharT>::__stage2_float_loop( } extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>; -#endif +# endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS num_get : public locale::facet, private __num_get<_CharT> { @@ -851,14 +858,14 @@ _InputIterator num_get<_CharT, _InputIterator>::__do_get_signed( // Stage 2 char_type __thousands_sep; const int __atoms_size = __num_get_base::__int_chr_cnt; -#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET char_type __atoms1[__atoms_size]; const char_type* __atoms = this->__do_widen(__iob, __atoms1); string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); -#else +# else char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); -#endif +# endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -900,14 +907,14 @@ _InputIterator num_get<_CharT, _InputIterator>::__do_get_unsigned( // Stage 2 char_type __thousands_sep; const int __atoms_size = __num_get_base::__int_chr_cnt; -#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET char_type __atoms1[__atoms_size]; const char_type* __atoms = this->__do_widen(__iob, __atoms1); string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); -#else +# else char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); -#endif +# endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -1050,9 +1057,9 @@ _InputIterator num_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>; -#endif +# endif struct _LIBCPP_EXPORTED_FROM_ABI __num_put_base { protected: @@ -1168,9 +1175,9 @@ void __num_put<_CharT>::__widen_and_group_float( } extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>; -#endif +# endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS num_put : public locale::facet, private __num_put<_CharT> { @@ -1455,9 +1462,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_ty } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; -#endif +# endif template <class _CharT, class _InputIterator> _LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits( @@ -1522,7 +1529,7 @@ _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__x() const; template <> _LIBCPP_EXPORTED_FROM_ABI const string& __time_get_c_storage<char>::__X() const; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> _LIBCPP_EXPORTED_FROM_ABI const wstring* __time_get_c_storage<wchar_t>::__weeks() const; template <> @@ -1537,7 +1544,7 @@ template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__x() const; template <> _LIBCPP_EXPORTED_FROM_ABI const wstring& __time_get_c_storage<wchar_t>::__X() const; -#endif +# endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS time_get : public locale::facet, public time_base, private __time_get_c_storage<_CharT> { @@ -1991,9 +1998,9 @@ _InputIterator time_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>; -#endif +# endif class _LIBCPP_EXPORTED_FROM_ABI __time_get { protected: @@ -2029,31 +2036,32 @@ private: string_type __analyze(char __fmt, const ctype<_CharT>&); }; -#define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \ - template <> \ - _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \ - template <> \ - _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \ - template <> \ - _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \ - template <> \ - _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ - template <> \ - _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze( \ - char, const ctype<_CharT>&); \ - extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \ - extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \ - extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \ - extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ - extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type \ - __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \ - /**/ +# define _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(_CharT) \ + template <> \ + _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() const; \ + template <> \ + _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \ + template <> \ + _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \ + template <> \ + _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ + template <> \ + _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type __time_get_storage<_CharT>::__analyze( \ + char, const ctype<_CharT>&); \ + extern template _LIBCPP_EXPORTED_FROM_ABI time_base::dateorder __time_get_storage<_CharT>::__do_date_order() \ + const; \ + extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const char*); \ + extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::__time_get_storage(const string&); \ + extern template _LIBCPP_EXPORTED_FROM_ABI void __time_get_storage<_CharT>::init(const ctype<_CharT>&); \ + extern template _LIBCPP_EXPORTED_FROM_ABI __time_get_storage<_CharT>::string_type \ + __time_get_storage<_CharT>::__analyze(char, const ctype<_CharT>&); \ + /**/ _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char) -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t) -#endif -#undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION +# endif +# undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS time_get_byname @@ -2086,9 +2094,9 @@ private: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>; -#endif +# endif class _LIBCPP_EXPORTED_FROM_ABI __time_put { locale_t __loc_; @@ -2099,9 +2107,9 @@ protected: __time_put(const string& __nm); ~__time_put(); void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const; -#endif +# endif }; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > @@ -2175,9 +2183,9 @@ _OutputIterator time_put<_CharT, _OutputIterator>::do_put( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>; -#endif +# endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS time_put_byname : public time_put<_CharT, _OutputIterator> { @@ -2197,9 +2205,9 @@ protected: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>; -#endif +# endif // money_base @@ -2264,10 +2272,10 @@ const bool moneypunct<_CharT, _International>::intl; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>; -#endif +# endif // moneypunct_byname @@ -2322,14 +2330,14 @@ _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<char, true>::init(const char*); extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, false>::init(const char*); template <> _LIBCPP_EXPORTED_FROM_ABI void moneypunct_byname<wchar_t, true>::init(const char*); extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>; -#endif +# endif // money_get @@ -2390,9 +2398,9 @@ void __money_get<_CharT>::__gather_info( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>; -#endif +# endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS money_get : public locale::facet, private __money_get<_CharT> { @@ -2700,9 +2708,9 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>; -#endif +# endif // money_put @@ -2878,9 +2886,9 @@ void __money_put<_CharT>::__format( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>; -#endif +# endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS money_put : public locale::facet, private __money_put<_CharT> { @@ -3024,9 +3032,9 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put( } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>; -#endif +# endif // messages @@ -3070,18 +3078,18 @@ locale::id messages<_CharT>::id; template <class _CharT> typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const { -#ifdef _LIBCPP_HAS_CATOPEN +# ifdef _LIBCPP_HAS_CATOPEN return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE); -#else // !_LIBCPP_HAS_CATOPEN +# else // !_LIBCPP_HAS_CATOPEN (void)__nm; return -1; -#endif // _LIBCPP_HAS_CATOPEN +# endif // _LIBCPP_HAS_CATOPEN } template <class _CharT> typename messages<_CharT>::string_type messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { -#ifdef _LIBCPP_HAS_CATOPEN +# ifdef _LIBCPP_HAS_CATOPEN string __ndflt; __narrow_to_utf8<sizeof(char_type) * __CHAR_BIT__>()( std::back_inserter(__ndflt), __dflt.c_str(), __dflt.c_str() + __dflt.size()); @@ -3091,27 +3099,27 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& string_type __w; __widen_from_utf8<sizeof(char_type) * __CHAR_BIT__>()(std::back_inserter(__w), __n, __n + std::strlen(__n)); return __w; -#else // !_LIBCPP_HAS_CATOPEN +# else // !_LIBCPP_HAS_CATOPEN (void)__c; (void)__set; (void)__msgid; return __dflt; -#endif // _LIBCPP_HAS_CATOPEN +# endif // _LIBCPP_HAS_CATOPEN } template <class _CharT> void messages<_CharT>::do_close(catalog __c) const { -#ifdef _LIBCPP_HAS_CATOPEN +# ifdef _LIBCPP_HAS_CATOPEN catclose((nl_catd)__c); -#else // !_LIBCPP_HAS_CATOPEN +# else // !_LIBCPP_HAS_CATOPEN (void)__c; -#endif // _LIBCPP_HAS_CATOPEN +# endif // _LIBCPP_HAS_CATOPEN } extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>; -#endif +# endif template <class _CharT> class _LIBCPP_TEMPLATE_VIS messages_byname : public messages<_CharT> { @@ -3128,11 +3136,11 @@ protected: }; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>; -#endif +# endif -#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT) +# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT) template <class _Codecvt, class _Elem = wchar_t, @@ -3153,19 +3161,19 @@ private: size_t __cvtcount_; public: -# ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {} _LIBCPP_HIDE_FROM_ABI explicit wstring_convert(_Codecvt* __pcvt); -# else +# else _LIBCPP_HIDE_FROM_ABI _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(_Codecvt* __pcvt = new _Codecvt); -# endif +# endif _LIBCPP_HIDE_FROM_ABI wstring_convert(_Codecvt* __pcvt, state_type __state); _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); -# ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI wstring_convert(wstring_convert&& __wc); -# endif +# endif _LIBCPP_HIDE_FROM_ABI ~wstring_convert(); wstring_convert(const wstring_convert& __wc) = delete; @@ -3210,7 +3218,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert( __cvtptr_ = new _Codecvt; } -# ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc> inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(wstring_convert&& __wc) @@ -3222,7 +3230,7 @@ inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert __wc.__cvtptr_ = nullptr; } -# endif // _LIBCPP_CXX03_LANG +# endif // _LIBCPP_CXX03_LANG _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc> @@ -3376,14 +3384,14 @@ private: bool __always_noconv_; public: -# ifndef _LIBCPP_CXX03_LANG +# ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {} explicit _LIBCPP_HIDE_FROM_ABI wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); -# else +# else _LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI wbuffer_convert(streambuf* __bytebuf = nullptr, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); -# endif +# endif _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert(); @@ -3739,7 +3747,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__ _LIBCPP_SUPPRESS_DEPRECATED_POP -#endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT) +# endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT) _LIBCPP_END_NAMESPACE_STD @@ -3747,6 +3755,8 @@ _LIBCPP_POP_MACROS // NOLINTEND(libcpp-robust-against-adl) +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> diff --git a/contrib/libs/cxxsupp/libcxx/include/locale.h b/contrib/libs/cxxsupp/libcxx/include/locale.h index 20910fa2f97..425bf47d437 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale.h +++ b/contrib/libs/cxxsupp/libcxx/include/locale.h @@ -35,10 +35,6 @@ Functions: #include <__config> -#if defined(_LIBCPP_HAS_NO_LOCALIZATION) -# error "<locale.h> is not supported since libc++ has been configured without support for localization." -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index 3fabceff68f..04d2316babe 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -585,6 +585,9 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__iterator/reverse_iterator.h> #include <__memory/addressof.h> #include <__memory/allocator.h> +#include <__memory/allocator_traits.h> +#include <__memory/pointer_traits.h> +#include <__memory/unique_ptr.h> #include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> #include <__ranges/concepts.h> @@ -592,9 +595,13 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__ranges/from_range.h> #include <__tree> #include <__type_traits/is_allocator.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> +#include <__utility/pair.h> #include <__utility/piecewise_construct.h> #include <__utility/swap.h> +#include <new> // for std::launder #include <stdexcept> #include <tuple> #include <version> @@ -1144,7 +1151,7 @@ public: _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } @@ -1825,7 +1832,7 @@ public: _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/math.h b/contrib/libs/cxxsupp/libcxx/include/math.h index 4d245d47368..99ec5ef28a0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/math.h +++ b/contrib/libs/cxxsupp/libcxx/include/math.h @@ -391,22 +391,22 @@ namespace __math { // template on non-double overloads to make them weaker than same overloads from MSVC runtime template <class = int> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(float __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } template <class = int> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(double __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } template <class = int> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(long double __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { return __x == 0 ? FP_ZERO : FP_NORMAL; } diff --git a/contrib/libs/cxxsupp/libcxx/include/math_cuda.h b/contrib/libs/cxxsupp/libcxx/include/math_cuda.h index afbea8a039b..0d8ff2bc0d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/math_cuda.h +++ b/contrib/libs/cxxsupp/libcxx/include/math_cuda.h @@ -372,29 +372,29 @@ extern "C++" { // signbit template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __builtin_signbit(__x); } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && std::is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __x < 0; } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && !std::is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { return false; } // fpclassify template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { return __x == 0 ? FP_ZERO : FP_NORMAL; } @@ -405,13 +405,13 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT template <class _A1, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT { return __builtin_isfinite((typename std::__promote<_A1>::type)__x); } template <class _A1, std::__enable_if_t<std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { return true; } @@ -419,27 +419,27 @@ _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfin template <class _A1, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { return __builtin_isinf((typename std::__promote<_A1>::type)__x); } template <class _A1> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI typename std::enable_if< std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, bool>::type isinf(_A1) _NOEXCEPT { return false; } #if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__) -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { return __builtin_isinf(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __x) _NOEXCEPT { return __builtin_isinf(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { return __builtin_isinf(__x); } # endif @@ -447,25 +447,25 @@ _LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI boo // isnan template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { return __builtin_isnan(__x); } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { return false; } #if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__) -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { return __builtin_isnan(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __x) _NOEXCEPT { return __builtin_isnan(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { return __builtin_isnan(__x); } # endif @@ -473,12 +473,12 @@ _LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI boo // isnormal template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { return __builtin_isnormal(__x); } template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> -_LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { return __x != 0; } @@ -487,7 +487,7 @@ _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnor template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_isgreater((type)__x, (type)__y); } @@ -497,7 +497,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_isgreaterequal((type)__x, (type)__y); } @@ -507,7 +507,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_isless((type)__x, (type)__y); } @@ -517,7 +517,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NO template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_islessequal((type)__x, (type)__y); } @@ -527,7 +527,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_islessgreater((type)__x, (type)__y); } @@ -537,7 +537,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 _ template <class _A1, class _A2, std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type type; return __builtin_isunordered((type)__x, (type)__y); } @@ -634,17 +634,17 @@ atan2(_A1 __y, _A2 __x) _NOEXCEPT // ceil -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return __builtin_ceilf(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return __builtin_ceilf(__x);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { return __builtin_ceil(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);} template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type ceil(_A1 __x) _NOEXCEPT {return __builtin_ceil((double)__x);} @@ -698,33 +698,33 @@ exp(_A1 __x) _NOEXCEPT {return __builtin_exp((double)__x);} // fabs -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return __builtin_fabsf(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return __builtin_fabsf(__x);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { return __builtin_fabs(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);} template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type fabs(_A1 __x) _NOEXCEPT {return __builtin_fabs((double)__x);} // floor -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return __builtin_floorf(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return __builtin_floorf(__x);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { return __builtin_floor(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);} template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type floor(_A1 __x) _NOEXCEPT {return __builtin_floor((double)__x);} @@ -988,31 +988,31 @@ atanh(_A1 __x) _NOEXCEPT {return __builtin_atanh((double)__x);} // cbrt -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT {return __builtin_cbrtf(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT {return __builtin_cbrtf(__x);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { return __builtin_cbrt(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return __builtin_cbrtl(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return __builtin_cbrtl(__x);} template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type cbrt(_A1 __x) _NOEXCEPT {return __builtin_cbrt((double)__x);} // copysign -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { return ::__builtin_copysignf(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { return ::__builtin_copysignl(__x, __y); } template <class _A1, class _A2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::__enable_if_t < std::is_arithmetic<_A1>::value && @@ -1152,17 +1152,17 @@ fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT // fmax -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT {return __builtin_fmaxf(__x, __y);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT {return __builtin_fmaxf(__x, __y);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { return __builtin_fmax(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return __builtin_fmaxl(__x, __y);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return __builtin_fmaxl(__x, __y);} template <class _A1, class _A2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::__enable_if_t < std::is_arithmetic<_A1>::value && @@ -1179,17 +1179,17 @@ fmax(_A1 __x, _A2 __y) _NOEXCEPT // fmin -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT {return __builtin_fminf(__x, __y);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT {return __builtin_fminf(__x, __y);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { return __builtin_fmin(__x, __y); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return __builtin_fminl(__x, __y);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return __builtin_fminl(__x, __y);} template <class _A1, class _A2> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::__enable_if_t < std::is_arithmetic<_A1>::value && @@ -1415,17 +1415,17 @@ lround(_A1 __x) _NOEXCEPT // nearbyint -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT {return __builtin_nearbyintf(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT {return __builtin_nearbyintf(__x);} template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { return __builtin_nearbyint(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return __builtin_nearbyintl(__x);} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return __builtin_nearbyintl(__x);} template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type nearbyint(_A1 __x) _NOEXCEPT {return __builtin_nearbyint((double)__x);} @@ -1528,23 +1528,23 @@ remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT // rint -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { return __builtin_rintf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { return __builtin_rint(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { return __builtin_rintl(__x); } template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type rint(_A1 __x) _NOEXCEPT { @@ -1553,23 +1553,23 @@ rint(_A1 __x) _NOEXCEPT // round -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { return __builtin_roundf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { return __builtin_round(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { return __builtin_roundl(__x); } template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type round(_A1 __x) _NOEXCEPT { @@ -1626,23 +1626,23 @@ tgamma(_A1 __x) _NOEXCEPT {return __builtin_tgamma((double)__x);} // trunc -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { return __builtin_truncf(__x); } template <class = int> -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { return __builtin_trunc(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { return __builtin_truncl(__x); } template <class _A1> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type trunc(_A1 __x) _NOEXCEPT { diff --git a/contrib/libs/cxxsupp/libcxx/include/mdspan b/contrib/libs/cxxsupp/libcxx/include/mdspan index 8d443f4acd1..29190e4a995 100644 --- a/contrib/libs/cxxsupp/libcxx/include/mdspan +++ b/contrib/libs/cxxsupp/libcxx/include/mdspan @@ -20,6 +20,10 @@ namespace std { template<class IndexType, size_t Rank> using dextents = see below; + // [mdspan.extents.dims], alias template dims + template<size_t Rank, class IndexType = size_t> + using dims = see below; // since C++26 + // [mdspan.layout], layout mapping struct layout_left; struct layout_right; @@ -405,17 +409,30 @@ namespace std { #define _LIBCPP_MDSPAN #include <__config> -#include <__fwd/mdspan.h> -#include <__mdspan/default_accessor.h> -#include <__mdspan/extents.h> -#include <__mdspan/layout_left.h> -#include <__mdspan/layout_right.h> -#include <__mdspan/layout_stride.h> -#include <__mdspan/mdspan.h> + +#if _LIBCPP_STD_VER >= 23 +# include <__fwd/mdspan.h> +# include <__mdspan/default_accessor.h> +# include <__mdspan/extents.h> +# include <__mdspan/layout_left.h> +# include <__mdspan/layout_right.h> +# include <__mdspan/layout_stride.h> +# include <__mdspan/mdspan.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <array> +# include <cinttypes> +# include <concepts> +# include <cstddef> +# include <limits> +# include <span> +#endif + #endif // _LIBCPP_MDSPAN diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index a8c0264eb9e..db3386cca48 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -182,8 +182,8 @@ public: raw_storage_iterator operator++(int); }; -template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept; -template <class T> void return_temporary_buffer(T* p) noexcept; +template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept; // deprecated in C++17, removed in C++20 +template <class T> void return_temporary_buffer(T* p) noexcept; // deprecated in C++17, removed in C++20 template <class T> T* addressof(T& r) noexcept; template <class T> T* addressof(const T&& r) noexcept = delete; @@ -451,7 +451,8 @@ public: constexpr unique_ptr& operator=(nullptr_t) noexcept; // constexpr since C++23 // observers - typename constexpr add_lvalue_reference<T>::type operator*() const; // constexpr since C++23 + constexpr + add_lvalue_reference<T>::type operator*() const noexcept(see below); // constexpr since C++23 constexpr pointer operator->() const noexcept; // constexpr since C++23 constexpr pointer get() const noexcept; // constexpr since C++23 constexpr deleter_type& get_deleter() noexcept; // constexpr since C++23 @@ -911,6 +912,22 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); template<size_t N, class T> [[nodiscard]] constexpr T* assume_aligned(T* ptr); // since C++20 +// [out.ptr.t], class template out_ptr_t +template<class Smart, class Pointer, class... Args> + class out_ptr_t; // since c++23 + +// [out.ptr], function template out_ptr +template<class Pointer = void, class Smart, class... Args> + auto out_ptr(Smart& s, Args&&... args); // since c++23 + +// [inout.ptr.t], class template inout_ptr_t +template<class Smart, class Pointer, class... Args> + class inout_ptr_t; // since c++23 + +// [inout.ptr], function template inout_ptr +template<class Pointer = void, class Smart, class... Args> + auto inout_ptr(Smart& s, Args&&... args); // since c++23 + } // std */ @@ -920,30 +937,40 @@ template<size_t N, class T> #include <__config> #include <__memory/addressof.h> #include <__memory/align.h> -#include <__memory/allocate_at_least.h> -#include <__memory/allocation_guard.h> #include <__memory/allocator.h> #include <__memory/allocator_arg_t.h> #include <__memory/allocator_traits.h> -#include <__memory/assume_aligned.h> #include <__memory/auto_ptr.h> -#include <__memory/compressed_pair.h> -#include <__memory/concepts.h> -#include <__memory/construct_at.h> +#include <__memory/inout_ptr.h> +#include <__memory/out_ptr.h> #include <__memory/pointer_traits.h> -#include <__memory/ranges_construct_at.h> -#include <__memory/ranges_uninitialized_algorithms.h> #include <__memory/raw_storage_iterator.h> #include <__memory/shared_ptr.h> #include <__memory/temporary_buffer.h> #include <__memory/uninitialized_algorithms.h> #include <__memory/unique_ptr.h> #include <__memory/uses_allocator.h> -#include <__memory/uses_allocator_construction.h> -#include <version> // standard-mandated includes +#if _LIBCPP_STD_VER >= 17 +# include <__memory/construct_at.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__memory/assume_aligned.h> +# include <__memory/concepts.h> +# include <__memory/ranges_construct_at.h> +# include <__memory/ranges_uninitialized_algorithms.h> +# include <__memory/uses_allocator_construction.h> +#endif + +#if _LIBCPP_STD_VER >= 23 +# include <__memory/allocate_at_least.h> +#endif + +#include <version> + // [memory.syn] #include <compare> diff --git a/contrib/libs/cxxsupp/libcxx/include/memory_resource b/contrib/libs/cxxsupp/libcxx/include/memory_resource index e9c87777e8f..e98ca20aa05 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory_resource +++ b/contrib/libs/cxxsupp/libcxx/include/memory_resource @@ -50,18 +50,31 @@ namespace std::pmr { */ #include <__config> -#include <__memory_resource/memory_resource.h> -#include <__memory_resource/monotonic_buffer_resource.h> -#include <__memory_resource/polymorphic_allocator.h> -#include <__memory_resource/pool_options.h> -#include <__memory_resource/synchronized_pool_resource.h> -#include <__memory_resource/unsynchronized_pool_resource.h> + +#if _LIBCPP_STD_VER >= 17 +# include <__memory_resource/memory_resource.h> +# include <__memory_resource/monotonic_buffer_resource.h> +# include <__memory_resource/polymorphic_allocator.h> +# include <__memory_resource/pool_options.h> +# include <__memory_resource/synchronized_pool_resource.h> +# include <__memory_resource/unsynchronized_pool_resource.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 +# include <cstddef> +# include <cstdint> +# include <limits> +# include <mutex> +# include <new> +# include <tuple> +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <stdexcept> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 9ffccf66ff0..c1181a36225 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -29,6 +29,16 @@ module std_bitset [system] { } module std_charconv [system] { header "charconv" + module chars_format { header "__charconv/chars_format.h" } + module from_chars_integral { header "__charconv/from_chars_integral.h" } + module from_chars_result { header "__charconv/from_chars_result.h" } + module tables { header "__charconv/tables.h" } + module to_chars { header "__charconv/to_chars.h" } + module to_chars_base_10 { header "__charconv/to_chars_base_10.h" } + module to_chars_floating_point { header "__charconv/to_chars_floating_point.h" } + module to_chars_integral { header "__charconv/to_chars_integral.h" } + module to_chars_result { header "__charconv/to_chars_result.h" } + module traits { header "__charconv/traits.h" } export * } module std_chrono [system] { @@ -53,10 +63,15 @@ module std_concepts [system] { } module std_condition_variable [system] { header "condition_variable" + module condition_variable { header "__condition_variable/condition_variable.h" } export * } module std_coroutine [system] { header "coroutine" + module coroutine_handle { header "__coroutine/coroutine_handle.h" } + module coroutine_traits { header "__coroutine/coroutine_traits.h" } + module noop_coroutine_handle { header "__coroutine/noop_coroutine_handle.h" } + module trivial_awaitables { header "__coroutine/trivial_awaitables.h" } export * } module std_deque [system] { @@ -77,6 +92,28 @@ module std_expected [system] { } module std_filesystem [system] { header "filesystem" + module copy_options { header "__filesystem/copy_options.h" } + module directory_entry { header "__filesystem/directory_entry.h" } + module directory_iterator { header "__filesystem/directory_iterator.h" } + module directory_options { header "__filesystem/directory_options.h" } + module file_status { header "__filesystem/file_status.h" } + module file_time_type { header "__filesystem/file_time_type.h" } + module file_type { header "__filesystem/file_type.h" } + module filesystem_error { + header "__filesystem/filesystem_error.h" + export std_private_memory_shared_ptr + } + module operations { header "__filesystem/operations.h" } + module path { + header "__filesystem/path.h" + export std_string // returned by various methods + } + module path_iterator { header "__filesystem/path_iterator.h" } + module perm_options { header "__filesystem/perm_options.h" } + module perms { header "__filesystem/perms.h" } + module recursive_directory_iterator { header "__filesystem/recursive_directory_iterator.h" } + module space_info { header "__filesystem/space_info.h" } + module u8path { header "__filesystem/u8path.h" } export * } module std_format [system] { @@ -149,6 +186,16 @@ module std_map [system] { } module std_mdspan [system] { header "mdspan" + module default_accessor { header "__mdspan/default_accessor.h" } + module extents { header "__mdspan/extents.h" } + module fwd { header "__fwd/mdspan.h" } + module layout_left { header "__mdspan/layout_left.h" } + module layout_right { header "__mdspan/layout_right.h" } + module layout_stride { header "__mdspan/layout_stride.h" } + module mdspan { + header "__mdspan/mdspan.h" + export std_array // for strides() + } export * } module std_memory [system] { @@ -245,8 +292,15 @@ module std_stdexcept [system] { header "stdexcept" export * } -module std_stop_token { +module std_stop_token [system] { header "stop_token" + private header "__stop_token/atomic_unique_lock.h" + private header "__stop_token/intrusive_list_view.h" + private header "__stop_token/intrusive_shared_ptr.h" + private header "__stop_token/stop_callback.h" + private header "__stop_token/stop_source.h" + private header "__stop_token/stop_state.h" + private header "__stop_token/stop_token.h" export * } module std_streambuf [system] { @@ -386,6 +440,11 @@ module std_cstdbool [system] { } module std_cstddef [system] { header "cstddef" + module byte { header "__cstddef/byte.h" } + module max_align_t { header "__cstddef/max_align_t.h" } + module nullptr_t { header "__cstddef/nullptr_t.h" } + module ptrdiff_t { header "__cstddef/ptrdiff_t.h" } + module size_t { header "__cstddef/size_t.h" } export * } module std_cstdint [system] { @@ -551,10 +610,6 @@ module std_experimental [system] { header "experimental/utility" export * } - module __config { - textual header "experimental/__config" - export * - } } // Convenience method to get all of the above modules in a single import statement. @@ -577,6 +632,9 @@ module std_private_bit_reference [system] { module std_private_fwd_bit_reference [system] { header "__fwd/bit_reference.h" } +module std_private_fwd_byte [system] { + header "__fwd/byte.h" +} module std_private_config [system] { textual header "__config" textual header "__configuration/abi.h" @@ -764,6 +822,7 @@ module std_private_algorithm_ranges_find_end [system module std_private_algorithm_ranges_find_first_of [system] { header "__algorithm/ranges_find_first_of.h" } module std_private_algorithm_ranges_find_if [system] { header "__algorithm/ranges_find_if.h" } module std_private_algorithm_ranges_find_if_not [system] { header "__algorithm/ranges_find_if_not.h" } +module std_private_algorithm_ranges_find_last [system] { header "__algorithm/ranges_find_last.h" } module std_private_algorithm_ranges_for_each [system] { header "__algorithm/ranges_for_each.h" export std_private_algorithm_in_fun_result @@ -1074,20 +1133,6 @@ module std_private_bit_invert_if [system] { header "__bit/invert_if.h" } module std_private_bit_popcount [system] { header "__bit/popcount.h" } module std_private_bit_rotate [system] { header "__bit/rotate.h" } -module std_private_charconv_chars_format [system] { header "__charconv/chars_format.h" } -module std_private_charconv_from_chars_integral [system] { header "__charconv/from_chars_integral.h" } -module std_private_charconv_from_chars_result [system] { header "__charconv/from_chars_result.h" } -module std_private_charconv_tables [system] { header "__charconv/tables.h" } -module std_private_charconv_to_chars [system] { header "__charconv/to_chars.h" } -module std_private_charconv_to_chars_base_10 [system] { header "__charconv/to_chars_base_10.h" } -module std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" } -module std_private_charconv_to_chars_integral [system] { header "__charconv/to_chars_integral.h" } -module std_private_charconv_to_chars_result [system] { - header "__charconv/to_chars_result.h" - export * -} -module std_private_charconv_traits [system] { header "__charconv/traits.h" } - module std_private_chrono_calendar [system] { header "__chrono/calendar.h" } module std_private_chrono_concepts [system] { header "__chrono/concepts.h" } module std_private_chrono_convert_to_timespec [system] { header "__chrono/convert_to_timespec.h" } @@ -1130,6 +1175,7 @@ module std_private_chrono_steady_clock [system] { } module std_private_chrono_time_zone [system] { header "__chrono/time_zone.h" + export std_private_memory_unique_ptr } module std_private_chrono_time_zone_link [system] { header "__chrono/time_zone_link.h" @@ -1211,16 +1257,6 @@ module std_private_concepts_semiregular [system] { header "__concepts/ module std_private_concepts_swappable [system] { header "__concepts/swappable.h" } module std_private_concepts_totally_ordered [system] { header "__concepts/totally_ordered.h" } -module std_private_condition_variable_condition_variable [system] { - header "__condition_variable/condition_variable.h" - export * -} - -module std_private_coroutine_coroutine_handle [system] { header "__coroutine/coroutine_handle.h" } -module std_private_coroutine_coroutine_traits [system] { header "__coroutine/coroutine_traits.h" } -module std_private_coroutine_noop_coroutine_handle [system] { header "__coroutine/noop_coroutine_handle.h" } -module std_private_coroutine_trivial_awaitables [system] { header "__coroutine/trivial_awaitables.h" } - module std_private_debug_utils_randomize_range [system] { header "__debug_utils/randomize_range.h" } module std_private_debug_utils_sanitizers [system] { header "__debug_utils/sanitizers.h" } module std_private_debug_utils_strict_weak_ordering_check [system] { @@ -1244,38 +1280,6 @@ module std_private_expected_expected [system] { header "__expected/ex module std_private_expected_unexpect [system] { header "__expected/unexpect.h" } module std_private_expected_unexpected [system] { header "__expected/unexpected.h" } -module std_private_filesystem_copy_options [system] { header "__filesystem/copy_options.h" } -module std_private_filesystem_directory_entry [system] { - header "__filesystem/directory_entry.h" - export * -} -module std_private_filesystem_directory_iterator [system] { - header "__filesystem/directory_iterator.h" - export * -} -module std_private_filesystem_directory_options [system] { header "__filesystem/directory_options.h" } -module std_private_filesystem_file_status [system] { header "__filesystem/file_status.h" } -module std_private_filesystem_file_time_type [system] { header "__filesystem/file_time_type.h" } -module std_private_filesystem_file_type [system] { header "__filesystem/file_type.h" } -module std_private_filesystem_filesystem_error [system] { - header "__filesystem/filesystem_error.h" - export * -} -module std_private_filesystem_operations [system] { header "__filesystem/operations.h" } -module std_private_filesystem_path [system] { - header "__filesystem/path.h" - export * -} -module std_private_filesystem_path_iterator [system] { header "__filesystem/path_iterator.h" } -module std_private_filesystem_perm_options [system] { header "__filesystem/perm_options.h" } -module std_private_filesystem_perms [system] { header "__filesystem/perms.h" } -module std_private_filesystem_recursive_directory_iterator [system] { - header "__filesystem/recursive_directory_iterator.h" - export * -} -module std_private_filesystem_space_info [system] { header "__filesystem/space_info.h" } -module std_private_filesystem_u8path [system] { header "__filesystem/u8path.h" } - module std_private_format_buffer [system] { header "__format/buffer.h" } module std_private_format_concepts [system] { header "__format/concepts.h" } module std_private_format_container_adaptor [system] { header "__format/container_adaptor.h" } @@ -1418,6 +1422,7 @@ module std_private_iterator_iterator [system] { header "__iterato module std_private_iterator_iterator_traits [system] { header "__iterator/iterator_traits.h" export std_private_type_traits_is_primary_template + export std_private_type_traits_integral_constant } module std_private_iterator_iterator_with_data [system] { header "__iterator/iterator_with_data.h" } module std_private_iterator_mergeable [system] { @@ -1480,20 +1485,10 @@ module std_private_math_modulo [system] { header "__mat module std_private_math_remainder [system] { header "__math/remainder.h" } module std_private_math_roots [system] { header "__math/roots.h" } module std_private_math_rounding_functions [system] { header "__math/rounding_functions.h" } +module std_private_math_special_functions [system] { header "__math/special_functions.h" } module std_private_math_traits [system] { header "__math/traits.h" } module std_private_math_trigonometric_functions [system] { header "__math/trigonometric_functions.h" } -module std_private_mdspan_default_accessor [system] { header "__mdspan/default_accessor.h" } -module std_private_mdspan_extents [system] { - header "__mdspan/extents.h" - export * -} -module std_private_mdspan_layout_left [system] { header "__mdspan/layout_left.h" } -module std_private_mdspan_layout_right [system] { header "__mdspan/layout_right.h" } -module std_private_mdspan_layout_stride [system] { header "__mdspan/layout_stride.h" } -module std_private_mdspan_mdspan [system] { header "__mdspan/mdspan.h" } -module std_private_mdspan_mdspan_fwd [system] { header "__fwd/mdspan.h" } - module std_private_memory_addressof [system] { header "__memory/addressof.h" } module std_private_memory_align [system] { header "__memory/align.h" } module std_private_memory_aligned_alloc [system] { header "__memory/aligned_alloc.h" } @@ -1517,6 +1512,9 @@ module std_private_memory_concepts [system] { module std_private_memory_construct_at [system] { header "__memory/construct_at.h" } module std_private_memory_destruct_n [system] { header "__memory/destruct_n.h" } module std_private_memory_fwd [system] { header "__fwd/memory.h" } +module std_private_memory_inout_ptr [system] { header "__memory/inout_ptr.h" } +module std_private_memory_noexcept_move_assign_container [system] { header "__memory/noexcept_move_assign_container.h" } +module std_private_memory_out_ptr [system] { header "__memory/out_ptr.h" } module std_private_memory_pointer_traits [system] { header "__memory/pointer_traits.h" } module std_private_memory_ranges_construct_at [system] { header "__memory/ranges_construct_at.h" } module std_private_memory_ranges_uninitialized_algorithms [system] { @@ -1544,6 +1542,11 @@ module std_private_memory_unique_ptr [system] { export std_private_type_traits_is_pointer export std_private_type_traits_type_identity } +module std_private_memory_unique_temporary_buffer [system] { + header "__memory/unique_temporary_buffer.h" + export std_private_memory_unique_ptr + export std_private_type_traits_is_constant_evaluated +} module std_private_memory_uses_allocator [system] { header "__memory/uses_allocator.h" } module std_private_memory_uses_allocator_construction [system] { header "__memory/uses_allocator_construction.h" } module std_private_memory_voidify [system] { header "__memory/voidify.h" } @@ -1584,41 +1587,25 @@ module std_private_numeric_transform_exclusive_scan [system] { header "__numeric module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" } module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" } -module std_private_pstl_backend [system] { +module std_private_pstl [system] { header "__pstl/backend.h" - export * -} -module std_private_pstl_backend_fwd [system] { header "__pstl/backend_fwd.h" - export * -} -module std_private_pstl_backends_default [system] { header "__pstl/backends/default.h" - export * -} -module std_private_pstl_backends_libdispatch [system] { header "__pstl/backends/libdispatch.h" - export * -} -module std_private_pstl_backends_serial [system] { header "__pstl/backends/serial.h" - export * -} -module std_private_pstl_backends_std_thread [system] { header "__pstl/backends/std_thread.h" - export * + header "__pstl/cpu_algos/any_of.h" + header "__pstl/cpu_algos/cpu_traits.h" + header "__pstl/cpu_algos/fill.h" + header "__pstl/cpu_algos/find_if.h" + header "__pstl/cpu_algos/for_each.h" + header "__pstl/cpu_algos/merge.h" + header "__pstl/cpu_algos/stable_sort.h" + header "__pstl/cpu_algos/transform.h" + header "__pstl/cpu_algos/transform_reduce.h" + header "__pstl/dispatch.h" + header "__pstl/handle_exception.h" } -module std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" } -module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" } -module std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" } -module std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" } -module std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" } -module std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" } -module std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" } -module std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" } -module std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" } -module std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" } -module std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" } module std_private_queue_fwd [system] { header "__fwd/queue.h" } @@ -1773,23 +1760,6 @@ module std_private_span_span_fwd [system] { header "__fwd/span.h" } module std_private_stack_fwd [system] { header "__fwd/stack.h" } -module std_private_stop_token_atomic_unique_lock [system] { header "__stop_token/atomic_unique_lock.h" } -module std_private_stop_token_intrusive_list_view [system] { header "__stop_token/intrusive_list_view.h" } -module std_private_stop_token_intrusive_shared_ptr [system] { header "__stop_token/intrusive_shared_ptr.h" } -module std_private_stop_token_stop_callback [system] { header "__stop_token/stop_callback.h" } -module std_private_stop_token_stop_source [system] { - header "__stop_token/stop_source.h" - export * -} -module std_private_stop_token_stop_state [system] { - header "__stop_token/stop_state.h" - export * -} -module std_private_stop_token_stop_token [system] { - header "__stop_token/stop_token.h" - export * -} - module std_private_string_char_traits [system] { header "__string/char_traits.h" export * @@ -1840,6 +1810,7 @@ module std_private_thread_thread [system] { module std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" } module std_private_tuple_find_index [system] { header "__tuple/find_index.h" } +module std_private_tuple_ignore [system] { header "__tuple/ignore.h" } module std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" } module std_private_tuple_tuple_like_no_subrange [system] { header "__tuple/tuple_like_no_subrange.h" @@ -1847,13 +1818,25 @@ module std_private_tuple_tuple_like_no_subrange [system] { module std_private_tuple_sfinae_helpers [system] { header "__tuple/sfinae_helpers.h" } module std_private_tuple_tuple_element [system] { header "__tuple/tuple_element.h" } module std_private_tuple_tuple_fwd [system] { header "__fwd/tuple.h" } +module std_private_get_fwd [system] { + header "__fwd/get.h" + export std_private_array_array_fwd + export std_private_complex_complex_fwd + export std_private_ranges_subrange_fwd + export std_private_tuple_tuple_fwd + export std_private_utility_pair_fwd + export std_private_variant_fwd +} module std_private_tuple_tuple_indices [system] { header "__tuple/tuple_indices.h" } module std_private_tuple_tuple_like [system] { header "__tuple/tuple_like.h" export * } module std_private_tuple_tuple_like_ext [system] { header "__tuple/tuple_like_ext.h" } -module std_private_tuple_tuple_size [system] { header "__tuple/tuple_size.h" } +module std_private_tuple_tuple_size [system] { + header "__tuple/tuple_size.h" + export std_private_type_traits_integral_constant +} module std_private_tuple_tuple_types [system] { header "__tuple/tuple_types.h" } module std_private_type_traits_add_const [system] { header "__type_traits/add_const.h" } @@ -1923,7 +1906,10 @@ module std_private_type_traits_is_array [system module std_private_type_traits_is_assignable [system] { header "__type_traits/is_assignable.h" } module std_private_type_traits_is_base_of [system] { header "__type_traits/is_base_of.h" } module std_private_type_traits_is_bounded_array [system] { header "__type_traits/is_bounded_array.h" } -module std_private_type_traits_is_callable [system] { header "__type_traits/is_callable.h" } +module std_private_type_traits_is_callable [system] { + header "__type_traits/is_callable.h" + export std_private_type_traits_integral_constant +} module std_private_type_traits_is_char_like_type [system] { header "__type_traits/is_char_like_type.h" } module std_private_type_traits_is_class [system] { header "__type_traits/is_class.h" } module std_private_type_traits_is_compound [system] { header "__type_traits/is_compound.h" } @@ -1958,11 +1944,15 @@ module std_private_type_traits_is_final [system module std_private_type_traits_is_floating_point [system] { header "__type_traits/is_floating_point.h" } module std_private_type_traits_is_function [system] { header "__type_traits/is_function.h" } module std_private_type_traits_is_fundamental [system] { header "__type_traits/is_fundamental.h" } -module std_private_type_traits_is_implicitly_default_constructible [system] { header "__type_traits/is_implicitly_default_constructible.h" } -module std_private_type_traits_is_integral [system] { header "__type_traits/is_integral.h" } +module std_private_type_traits_is_implicitly_default_constructible [system] { + header "__type_traits/is_implicitly_default_constructible.h" + export std_private_type_traits_integral_constant +} +module std_private_type_traits_is_integral [system] { + header "__type_traits/is_integral.h" + export std_private_type_traits_integral_constant +} module std_private_type_traits_is_literal_type [system] { header "__type_traits/is_literal_type.h" } -module std_private_type_traits_is_member_function_pointer [system] { header "__type_traits/is_member_function_pointer.h" } -module std_private_type_traits_is_member_object_pointer [system] { header "__type_traits/is_member_object_pointer.h" } module std_private_type_traits_is_member_pointer [system] { header "__type_traits/is_member_pointer.h" } module std_private_type_traits_is_nothrow_assignable [system] { header "__type_traits/is_nothrow_assignable.h" } module std_private_type_traits_is_nothrow_constructible [system] { @@ -1989,7 +1979,10 @@ module std_private_type_traits_is_primary_template [system header "__type_traits/is_primary_template.h" export std_private_type_traits_enable_if } -module std_private_type_traits_is_reference [system] { header "__type_traits/is_reference.h" } +module std_private_type_traits_is_reference [system] { + header "__type_traits/is_reference.h" + export std_private_type_traits_integral_constant +} module std_private_type_traits_is_reference_wrapper [system] { header "__type_traits/is_reference_wrapper.h" } module std_private_type_traits_is_referenceable [system] { header "__type_traits/is_referenceable.h" } module std_private_type_traits_is_same [system] { @@ -2000,7 +1993,6 @@ module std_private_type_traits_is_scalar [system header "__type_traits/is_scalar.h" export std_private_type_traits_is_null_pointer } -module std_private_type_traits_is_scoped_enum [system] { header "__type_traits/is_scoped_enum.h" } module std_private_type_traits_is_signed [system] { header "__type_traits/is_signed.h" } module std_private_type_traits_is_signed_integer [system] { header "__type_traits/is_signed_integer.h" } module std_private_type_traits_is_specialization [system] { header "__type_traits/is_specialization.h" } @@ -2012,7 +2004,10 @@ module std_private_type_traits_is_swappable [system module std_private_type_traits_is_trivial [system] { header "__type_traits/is_trivial.h" } module std_private_type_traits_is_trivially_assignable [system] { header "__type_traits/is_trivially_assignable.h" } module std_private_type_traits_is_trivially_constructible [system] { header "__type_traits/is_trivially_constructible.h" } -module std_private_type_traits_is_trivially_copyable [system] { header "__type_traits/is_trivially_copyable.h" } +module std_private_type_traits_is_trivially_copyable [system] { + header "__type_traits/is_trivially_copyable.h" + export std_private_type_traits_integral_constant +} module std_private_type_traits_is_trivially_destructible [system] { header "__type_traits/is_trivially_destructible.h" } module std_private_type_traits_is_trivially_lexicographically_comparable [system] { header "__type_traits/is_trivially_lexicographically_comparable.h" } module std_private_type_traits_is_trivially_relocatable [system] { header "__type_traits/is_trivially_relocatable.h" } @@ -2037,7 +2032,6 @@ module std_private_type_traits_make_unsigned [system module std_private_type_traits_maybe_const [system] { header "__type_traits/maybe_const.h" } module std_private_type_traits_nat [system] { header "__type_traits/nat.h" } module std_private_type_traits_negation [system] { header "__type_traits/negation.h" } -module std_private_type_traits_noexcept_move_assign_container [system] { header "__type_traits/noexcept_move_assign_container.h" } module std_private_type_traits_promote [system] { header "__type_traits/promote.h" } module std_private_type_traits_rank [system] { header "__type_traits/rank.h" } module std_private_type_traits_remove_all_extents [system] { header "__type_traits/remove_all_extents.h" } @@ -2081,7 +2075,10 @@ module std_private_utility_exception_guard [system] { header "__utility/e module std_private_utility_exchange [system] { header "__utility/exchange.h" } module std_private_utility_forward [system] { header "__utility/forward.h" } module std_private_utility_forward_like [system] { header "__utility/forward_like.h" } -module std_private_utility_in_place [system] { header "__utility/in_place.h" } +module std_private_utility_in_place [system] { + header "__utility/in_place.h" + export std_private_type_traits_integral_constant +} module std_private_utility_integer_sequence [system] { header "__utility/integer_sequence.h" } module std_private_utility_is_pointer_in_range [system] { header "__utility/is_pointer_in_range.h" } module std_private_utility_is_valid_range [system] { header "__utility/is_valid_range.h" } @@ -2120,5 +2117,6 @@ module std_private_utility_to_underlying [system] { header "__utility/ module std_private_utility_unreachable [system] { header "__utility/unreachable.h" } module std_private_variant_monostate [system] { header "__variant/monostate.h" } +module std_private_variant_fwd [system] { header "__fwd/variant.h" } module std_private_vector_fwd [system] { header "__fwd/vector.h" } diff --git a/contrib/libs/cxxsupp/libcxx/include/new b/contrib/libs/cxxsupp/libcxx/include/new index 214dbc39853..3252b0bb1ab 100644 --- a/contrib/libs/cxxsupp/libcxx/include/new +++ b/contrib/libs/cxxsupp/libcxx/include/new @@ -79,8 +79,8 @@ void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // repla void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17 -void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++20 -void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++20 +void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 +void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26 void operator delete (void* ptr, void*) noexcept; void operator delete[](void* ptr, void*) noexcept; @@ -166,9 +166,9 @@ public: }; #endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_array_new_length(); #else @@ -203,8 +203,8 @@ inline constexpr destroying_delete_t destroying_delete{}; #if !defined(_LIBCPP_ABI_VCRUNTIME) -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; @@ -212,8 +212,8 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; # endif -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; @@ -222,8 +222,8 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) # endif # ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; @@ -231,9 +231,9 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, c _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; # endif -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; -_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; @@ -242,8 +242,14 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, # endif # endif -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT { return __p; } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT { return __p; } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void* +operator new(std::size_t, void* __p) _NOEXCEPT { + return __p; +} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void* +operator new[](std::size_t, void* __p) _NOEXCEPT { + return __p; +} inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {} inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {} @@ -328,7 +334,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate_unsized(void* __ptr, size_ } template <class _Tp> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { static_assert(!(is_function<_Tp>::value), "can't launder functions"); static_assert(!(is_same<void, __remove_cv_t<_Tp> >::value), "can't launder cv-void"); return __builtin_launder(__p); diff --git a/contrib/libs/cxxsupp/libcxx/include/numeric b/contrib/libs/cxxsupp/libcxx/include/numeric index 9fb5e9fb1da..6b92ce3a071 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numeric +++ b/contrib/libs/cxxsupp/libcxx/include/numeric @@ -157,31 +157,40 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin */ #include <__config> -#include <version> #include <__numeric/accumulate.h> #include <__numeric/adjacent_difference.h> -#include <__numeric/exclusive_scan.h> -#include <__numeric/gcd_lcm.h> -#include <__numeric/inclusive_scan.h> #include <__numeric/inner_product.h> #include <__numeric/iota.h> -#include <__numeric/midpoint.h> #include <__numeric/partial_sum.h> -#include <__numeric/reduce.h> -#include <__numeric/saturation_arithmetic.h> -#include <__numeric/transform_exclusive_scan.h> -#include <__numeric/transform_inclusive_scan.h> -#include <__numeric/transform_reduce.h> #if _LIBCPP_STD_VER >= 17 +# include <__numeric/exclusive_scan.h> +# include <__numeric/gcd_lcm.h> +# include <__numeric/inclusive_scan.h> # include <__numeric/pstl.h> +# include <__numeric/reduce.h> +# include <__numeric/transform_exclusive_scan.h> +# include <__numeric/transform_inclusive_scan.h> +# include <__numeric/transform_reduce.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__numeric/midpoint.h> +# include <__numeric/saturation_arithmetic.h> #endif +#include <version> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 +# include <initializer_list> +# include <limits> +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <climits> # include <cmath> diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index 992189b0e0f..f5c46aa0364 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -136,12 +136,12 @@ namespace std { void swap(optional &) noexcept(see below ); // constexpr in C++20 // [optional.observe], observers - constexpr T const *operator->() const; - constexpr T *operator->(); - constexpr T const &operator*() const &; - constexpr T &operator*() &; - constexpr T &&operator*() &&; - constexpr const T &&operator*() const &&; + constexpr T const *operator->() const noexcept; + constexpr T *operator->() noexcept; + constexpr T const &operator*() const & noexcept; + constexpr T &operator*() & noexcept; + constexpr T &&operator*() && noexcept; + constexpr const T &&operator*() const && noexcept; constexpr explicit operator bool() const noexcept; constexpr bool has_value() const noexcept; constexpr T const &value() const &; @@ -179,6 +179,7 @@ namespace std { #include <__assert> #include <__compare/compare_three_way_result.h> +#include <__compare/ordering.h> #include <__compare/three_way_comparable.h> #include <__concepts/invocable.h> #include <__config> @@ -195,6 +196,8 @@ namespace std { #include <__type_traits/conjunction.h> #include <__type_traits/decay.h> #include <__type_traits/disjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_array.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> @@ -255,7 +258,7 @@ public: _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void +[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void __throw_bad_optional_access() { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_optional_access(); @@ -299,9 +302,9 @@ struct __optional_destruct_base<_Tp, false> { _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args) : __val_(std::forward<_Args>(__args)...), __engaged_(true) {} -# if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 20 template <class _Fp, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base( + _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base( __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) : __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {} # endif @@ -330,7 +333,7 @@ struct __optional_destruct_base<_Tp, true> { _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args) : __val_(std::forward<_Args>(__args)...), __engaged_(true) {} -# if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 20 template <class _Fp, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base( __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) @@ -706,9 +709,12 @@ public: this->__construct_from(std::move(__v)); } -# if _LIBCPP_STD_VER >= 23 - template <class _Fp, class... _Args> - _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) +# if _LIBCPP_STD_VER >= 20 + template <class _Tag, + class _Fp, + class... _Args, + __enable_if_t<_IsSame<_Tag, __optional_construct_from_invoke_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Tag, _Fp&& __f, _Args&&... __args) : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {} # endif @@ -783,12 +789,12 @@ public: } } - _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const { + _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const noexcept { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); return std::addressof(this->__get()); } - _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() { + _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() noexcept { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value"); return std::addressof(this->__get()); } @@ -856,7 +862,7 @@ public: return this->has_value() ? std::move(this->__get()) : static_cast<value_type>(std::forward<_Up>(__v)); } -# if _LIBCPP_STD_VER >= 23 +# if _LIBCPP_STD_VER >= 20 template <class _Func> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) & { using _Up = invoke_result_t<_Func, value_type&>; @@ -966,7 +972,7 @@ public: return std::move(*this); return std::forward<_Func>(__f)(); } -# endif // _LIBCPP_STD_VER >= 23 +# endif // _LIBCPP_STD_VER >= 20 using __base::reset; }; diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream index f75110e7d73..83742882f7b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ostream +++ b/contrib/libs/cxxsupp/libcxx/include/ostream @@ -173,21 +173,32 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); */ #include <__config> -#include <__ostream/basic_ostream.h> -#include <__ostream/print.h> -#include <version> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__ostream/basic_ostream.h> + +# if _LIBCPP_STD_VER >= 23 +# include <__ostream/print.h> +# endif + +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> # include <cstdio> # include <cstdlib> +# include <format> # include <iosfwd> # include <iterator> +# include <print> # include <stdexcept> # include <type_traits> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/print b/contrib/libs/cxxsupp/libcxx/include/print index 1a579daff27..2798a6bda26 100644 --- a/contrib/libs/cxxsupp/libcxx/include/print +++ b/contrib/libs/cxxsupp/libcxx/include/print @@ -199,7 +199,7 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) // the behavior in the test. This is not part of the public API. # ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream); -# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 +# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || defined(_LIBCPP_HAS_NO_TERMINAL) return false; # elif defined(_LIBCPP_WIN32API) return std::__is_windows_terminal(__stream); diff --git a/contrib/libs/cxxsupp/libcxx/include/queue b/contrib/libs/cxxsupp/libcxx/include/queue index 9508de9f9ef..db9ad26eaed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/queue +++ b/contrib/libs/cxxsupp/libcxx/include/queue @@ -372,7 +372,7 @@ public: _LIBCPP_HIDE_FROM_ABI queue(queue&& __q, const _Alloc& __a) : c(std::move(__q.c), __a) {} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); } _LIBCPP_HIDE_FROM_ABI reference front() { return c.front(); } @@ -416,7 +416,7 @@ public: swap(c, __q.c); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } template <class _T1, class _OtherContainer> friend _LIBCPP_HIDE_FROM_ABI bool @@ -649,7 +649,7 @@ public: #endif - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); } _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); } @@ -678,7 +678,7 @@ public: _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q) _NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>); - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } }; #if _LIBCPP_STD_VER >= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/random b/contrib/libs/cxxsupp/libcxx/include/random index 9edd6c4608e..6cc3760c20e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/random +++ b/contrib/libs/cxxsupp/libcxx/include/random @@ -1682,7 +1682,6 @@ class piecewise_linear_distribution #include <__random/binomial_distribution.h> #include <__random/cauchy_distribution.h> #include <__random/chi_squared_distribution.h> -#include <__random/clamp_to_integral.h> #include <__random/default_random_engine.h> #include <__random/discard_block_engine.h> #include <__random/discrete_distribution.h> @@ -1694,10 +1693,8 @@ class piecewise_linear_distribution #include <__random/geometric_distribution.h> #include <__random/independent_bits_engine.h> #include <__random/is_seed_sequence.h> -#include <__random/is_valid.h> #include <__random/knuth_b.h> #include <__random/linear_congruential_engine.h> -#include <__random/log2.h> #include <__random/lognormal_distribution.h> #include <__random/mersenne_twister_engine.h> #include <__random/negative_binomial_distribution.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/ranges b/contrib/libs/cxxsupp/libcxx/include/ranges index 07a525ed864..fa35874265d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ranges +++ b/contrib/libs/cxxsupp/libcxx/include/ranges @@ -381,49 +381,56 @@ namespace std { */ #include <__config> -#include <__ranges/access.h> -#include <__ranges/all.h> -#include <__ranges/as_rvalue_view.h> -#include <__ranges/chunk_by_view.h> -#include <__ranges/common_view.h> -#include <__ranges/concepts.h> -#include <__ranges/counted.h> -#include <__ranges/dangling.h> -#include <__ranges/data.h> -#include <__ranges/drop_view.h> -#include <__ranges/drop_while_view.h> -#include <__ranges/elements_view.h> -#include <__ranges/empty.h> -#include <__ranges/empty_view.h> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/enable_view.h> -#include <__ranges/filter_view.h> -#include <__ranges/from_range.h> -#include <__ranges/iota_view.h> -#include <__ranges/join_view.h> -#include <__ranges/lazy_split_view.h> -#include <__ranges/rbegin.h> -#include <__ranges/ref_view.h> -#include <__ranges/rend.h> -#include <__ranges/repeat_view.h> -#include <__ranges/reverse_view.h> -#include <__ranges/single_view.h> -#include <__ranges/size.h> -#include <__ranges/split_view.h> -#include <__ranges/subrange.h> -#include <__ranges/take_view.h> -#include <__ranges/take_while_view.h> -#include <__ranges/to.h> -#include <__ranges/transform_view.h> -#include <__ranges/view_interface.h> -#include <__ranges/views.h> -#include <__ranges/zip_view.h> -#include <version> -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include <__ranges/istream_view.h> +#if _LIBCPP_STD_VER >= 20 +# include <__ranges/access.h> +# include <__ranges/all.h> +# include <__ranges/common_view.h> +# include <__ranges/concepts.h> +# include <__ranges/counted.h> +# include <__ranges/dangling.h> +# include <__ranges/data.h> +# include <__ranges/drop_view.h> +# include <__ranges/drop_while_view.h> +# include <__ranges/elements_view.h> +# include <__ranges/empty.h> +# include <__ranges/empty_view.h> +# include <__ranges/enable_borrowed_range.h> +# include <__ranges/enable_view.h> +# include <__ranges/filter_view.h> +# include <__ranges/iota_view.h> +# include <__ranges/join_view.h> +# include <__ranges/lazy_split_view.h> +# include <__ranges/rbegin.h> +# include <__ranges/ref_view.h> +# include <__ranges/rend.h> +# include <__ranges/reverse_view.h> +# include <__ranges/single_view.h> +# include <__ranges/size.h> +# include <__ranges/split_view.h> +# include <__ranges/subrange.h> +# include <__ranges/take_view.h> +# include <__ranges/take_while_view.h> +# include <__ranges/transform_view.h> +# include <__ranges/view_interface.h> +# include <__ranges/views.h> + +# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include <__ranges/istream_view.h> +# endif +#endif + +#if _LIBCPP_STD_VER >= 23 +# include <__ranges/as_rvalue_view.h> +# include <__ranges/chunk_by_view.h> +# include <__ranges/from_range.h> +# include <__ranges/repeat_view.h> +# include <__ranges/to.h> +# include <__ranges/zip_view.h> #endif +#include <version> + // standard-mandated includes // [ranges.syn] @@ -439,6 +446,14 @@ namespace std { # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include <cstddef> +# include <limits> +# include <optional> +# include <span> +# include <tuple> +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdlib> # include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/regex b/contrib/libs/cxxsupp/libcxx/include/regex index b8141351213..d6b8768a257 100644 --- a/contrib/libs/cxxsupp/libcxx/include/regex +++ b/contrib/libs/cxxsupp/libcxx/include/regex @@ -983,7 +983,7 @@ public: }; template <regex_constants::error_type _Ev> -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw regex_error(_Ev); #else @@ -3921,7 +3921,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape( if (__hd == -1) __throw_regex_error<regex_constants::error_escape>(); __sum = 16 * __sum + static_cast<unsigned>(__hd); - // fallthrough + _LIBCPP_FALLTHROUGH(); case 'x': ++__first; if (__first == __last) @@ -4577,7 +4577,7 @@ public: // size: _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __matches_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __matches_.max_size(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; } // element access: _LIBCPP_HIDE_FROM_ABI difference_type length(size_type __sub = 0) const { diff --git a/contrib/libs/cxxsupp/libcxx/include/scoped_allocator b/contrib/libs/cxxsupp/libcxx/include/scoped_allocator index a49ff465b1d..13e43c2f15a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/scoped_allocator +++ b/contrib/libs/cxxsupp/libcxx/include/scoped_allocator @@ -389,10 +389,10 @@ public: return _Base::outer_allocator(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) { return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, const_void_pointer __hint) { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, const_void_pointer __hint) { return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n, __hint); } diff --git a/contrib/libs/cxxsupp/libcxx/include/semaphore b/contrib/libs/cxxsupp/libcxx/include/semaphore index 8d3b04475c0..bf6317c587e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/semaphore +++ b/contrib/libs/cxxsupp/libcxx/include/semaphore @@ -16,7 +16,7 @@ namespace std { template<ptrdiff_t least_max_value = implementation-defined> -class counting_semaphore +class counting_semaphore // since C++20 { public: static constexpr ptrdiff_t max() noexcept; @@ -39,7 +39,7 @@ private: ptrdiff_t counter; // exposition only }; -using binary_semaphore = counting_semaphore<1>; +using binary_semaphore = counting_semaphore<1>; // since C++20 } @@ -47,30 +47,28 @@ using binary_semaphore = counting_semaphore<1>; #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<semaphore> is not supported since libc++ has been configured without support for threads." -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) -#include <__assert> -#include <__atomic/atomic_base.h> -#include <__atomic/atomic_sync.h> -#include <__atomic/memory_order.h> -#include <__chrono/time_point.h> -#include <__thread/poll_with_backoff.h> -#include <__thread/support.h> -#include <__thread/timed_backoff_policy.h> -#include <cstddef> -#include <limits> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# include <__assert> +# include <__atomic/atomic_base.h> +# include <__atomic/atomic_sync.h> +# include <__atomic/memory_order.h> +# include <__chrono/time_point.h> +# include <__thread/poll_with_backoff.h> +# include <__thread/support.h> +# include <__thread/timed_backoff_policy.h> +# include <cstddef> +# include <limits> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> -#if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -82,7 +80,7 @@ functions. It avoids contention against users' own use of those facilities. */ -# define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max()) +# define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max()) class __atomic_semaphore_base { __atomic_base<ptrdiff_t> __a_; @@ -126,7 +124,7 @@ private: }; template <ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX> -class _LIBCPP_DEPRECATED_ATOMIC_SYNC counting_semaphore { +class counting_semaphore { __atomic_semaphore_base __semaphore_; public: @@ -171,18 +169,18 @@ public: } }; -_LIBCPP_SUPPRESS_DEPRECATED_PUSH -using binary_semaphore _LIBCPP_DEPRECATED_ATOMIC_SYNC = counting_semaphore<1>; -_LIBCPP_SUPPRESS_DEPRECATED_POP +using binary_semaphore = counting_semaphore<1>; _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> #endif -#endif //_LIBCPP_SEMAPHORE +#endif // _LIBCPP_SEMAPHORE diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index f2d2b05f931..6215f3ce493 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -524,14 +524,23 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 #include <__iterator/ranges_iterator_traits.h> #include <__iterator/reverse_iterator.h> #include <__memory/allocator.h> +#include <__memory/allocator_traits.h> #include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> #include <__ranges/concepts.h> #include <__ranges/container_compatible_range.h> #include <__ranges/from_range.h> #include <__tree> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> +#include <__utility/move.h> +#include <__utility/pair.h> #include <version> // standard-mandated includes @@ -713,7 +722,7 @@ public: _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } @@ -1171,7 +1180,7 @@ public: _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } @@ -1454,8 +1463,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, template <class _Key, class _Allocator> _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key> operator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/shared_mutex b/contrib/libs/cxxsupp/libcxx/include/shared_mutex index 397ac290d9b..f63bd254938 100644 --- a/contrib/libs/cxxsupp/libcxx/include/shared_mutex +++ b/contrib/libs/cxxsupp/libcxx/include/shared_mutex @@ -124,31 +124,29 @@ template <class Mutex> #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<shared_mutex> is not supported since libc++ has been configured without support for threads." -#endif - -#include <__chrono/duration.h> -#include <__chrono/steady_clock.h> -#include <__chrono/time_point.h> -#include <__condition_variable/condition_variable.h> -#include <__memory/addressof.h> -#include <__mutex/mutex.h> -#include <__mutex/tag_types.h> -#include <__mutex/unique_lock.h> -#include <__system_error/system_error.h> -#include <__utility/swap.h> -#include <cerrno> -#include <version> +#if !defined(_LIBCPP_HAS_NO_THREADS) + +# include <__chrono/duration.h> +# include <__chrono/steady_clock.h> +# include <__chrono/time_point.h> +# include <__condition_variable/condition_variable.h> +# include <__memory/addressof.h> +# include <__mutex/mutex.h> +# include <__mutex/tag_types.h> +# include <__mutex/unique_lock.h> +# include <__system_error/system_error.h> +# include <__utility/swap.h> +# include <cerrno> +# include <version> _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> -#if _LIBCPP_STD_VER >= 14 +# if _LIBCPP_STD_VER >= 14 -# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -# endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -181,7 +179,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base { // native_handle_type native_handle(); // See 30.2.3 }; -# if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_mutex")) shared_mutex { __shared_mutex_base __base_; @@ -218,7 +216,7 @@ public: // typedef __shared_mutex_base::native_handle_type native_handle_type; // _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return __base::unlock_shared(); } }; -# endif +# endif class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_timed_mutex")) shared_timed_mutex { @@ -453,10 +451,12 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(shared_lock<_Mutex>& __x, shared_lock<_Mu _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER >= 14 +# endif // _LIBCPP_STD_VER >= 14 _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <system_error> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index 60d76d830f0..a32f7a372e2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -206,11 +206,11 @@ struct __is_std_span<span<_Tp, _Sz>> : true_type {}; template <class _Range, class _ElementType> concept __span_compatible_range = + !__is_std_span<remove_cvref_t<_Range>>::value && // ranges::contiguous_range<_Range> && // ranges::sized_range<_Range> && // (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && // - !__is_std_span<remove_cvref_t<_Range>>::value && // - !__is_std_array<remove_cvref_t<_Range>>::value && // + !__is_std_array_v<remove_cvref_t<_Range>> && // !is_array_v<remove_cvref_t<_Range>> && // is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>; diff --git a/contrib/libs/cxxsupp/libcxx/include/sstream b/contrib/libs/cxxsupp/libcxx/include/sstream index 9ba43ffeb85..c29abab9c5f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/sstream +++ b/contrib/libs/cxxsupp/libcxx/include/sstream @@ -313,21 +313,26 @@ typedef basic_stringstream<wchar_t> wstringstream; // clang-format on #include <__config> -#include <__fwd/sstream.h> -#include <__ostream/basic_ostream.h> -#include <__type_traits/is_convertible.h> -#include <__utility/swap.h> -#include <istream> -#include <string> -#include <string_view> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#ifndef _LIBCPP_HAS_NO_LOCALIZATION + +# include <__fwd/sstream.h> +# include <__ostream/basic_ostream.h> +# include <__type_traits/is_convertible.h> +# include <__utility/swap.h> +# include <ios> +# include <istream> +# include <locale> +# include <string> +# include <string_view> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -354,9 +359,15 @@ private: public: // [stringbuf.cons] constructors: - _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {} + _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) { + // it is implementation-defined whether we initialize eback() & friends to nullptr, and libc++ doesn't + __init_buf_ptrs(); + } - _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) {} + _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) { + // it is implementation-defined whether we initialize eback() & friends to nullptr, and libc++ doesn't + __init_buf_ptrs(); + } _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out) @@ -364,12 +375,14 @@ public: str(__s); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const allocator_type& __a) : basic_stringbuf(ios_base::in | ios_base::out, __a) {} _LIBCPP_HIDE_FROM_ABI basic_stringbuf(ios_base::openmode __wch, const allocator_type& __a) - : __str_(__a), __hm_(nullptr), __mode_(__wch) {} + : __str_(__a), __hm_(nullptr), __mode_(__wch) { + __init_buf_ptrs(); + } _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(string_type&& __s, ios_base::openmode __wch = ios_base::in | ios_base::out) @@ -396,9 +409,9 @@ public: : __str_(__s), __hm_(nullptr), __mode_(__wch) { __init_buf_ptrs(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> @@ -420,37 +433,37 @@ public: __init_buf_ptrs(); } -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 basic_stringbuf(const basic_stringbuf&) = delete; basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { __move_init(std::move(__rhs)); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a) : basic_stringbuf(__rhs.__mode_, __a) { __move_init(std::move(__rhs)); } -#endif +# endif // [stringbuf.assign] Assign and swap: basic_stringbuf& operator=(const basic_stringbuf&) = delete; basic_stringbuf& operator=(basic_stringbuf&& __rhs); void swap(basic_stringbuf& __rhs) -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value || allocator_traits<allocator_type>::is_always_equal::value) -#endif +# endif ; // [stringbuf.members] Member functions: -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); } -#endif +# endif -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) string_type str() const; -#else +# else _LIBCPP_HIDE_FROM_ABI string_type str() const& { return str(__str_.get_allocator()); } _LIBCPP_HIDE_FROM_ABI string_type str() && { @@ -464,9 +477,9 @@ public: __init_buf_ptrs(); return __result; } -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> requires __is_allocator<_SAlloc>::value _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const { @@ -474,14 +487,14 @@ public: } _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept; -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 void str(const string_type& __s) { __str_ = __s; __init_buf_ptrs(); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> requires(!is_same_v<_SAlloc, allocator_type>) _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) { @@ -493,9 +506,9 @@ public: __str_ = std::move(__s); __init_buf_ptrs(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> @@ -505,7 +518,7 @@ public: __init_buf_ptrs(); } -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 protected: // [stringbuf.virtuals] Overridden virtual functions: @@ -601,10 +614,10 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) template <class _CharT, class _Traits, class _Allocator> void basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 noexcept(allocator_traits<_Allocator>::propagate_on_container_swap::value || allocator_traits<_Allocator>::is_always_equal::value) -#endif +# endif { char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __rbinp = -1; @@ -674,14 +687,14 @@ void basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) template <class _CharT, class _Traits, class _Allocator> inline _LIBCPP_HIDE_FROM_ABI void swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, basic_stringbuf<_CharT, _Traits, _Allocator>& __y) -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 noexcept(noexcept(__x.swap(__y))) -#endif +# endif { __x.swap(__y); } -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::str() const { if (__mode_ & ios_base::out) { @@ -692,7 +705,7 @@ basic_string<_CharT, _Traits, _Allocator> basic_stringbuf<_CharT, _Traits, _Allo return string_type(this->eback(), this->egptr(), __str_.get_allocator()); return string_type(__str_.get_allocator()); } -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) template <class _CharT, class _Traits, class _Allocator> _LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__init_buf_ptrs() { @@ -718,7 +731,7 @@ _LIBCPP_HIDE_FROM_ABI void basic_stringbuf<_CharT, _Traits, _Allocator>::__init_ } } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits, class _Allocator> _LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT, _Traits> basic_stringbuf<_CharT, _Traits, _Allocator>::view() const noexcept { @@ -730,7 +743,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::view() const noexcept { return basic_string_view<_CharT, _Traits>(this->eback(), this->egptr()); return basic_string_view<_CharT, _Traits>(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type @@ -773,9 +786,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) { if (this->pptr() == this->epptr()) { if (!(__mode_ & ios_base::out)) return traits_type::eof(); -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS ptrdiff_t __nout = this->pptr() - this->pbase(); ptrdiff_t __hm = __hm_ - this->pbase(); __str_.push_back(char_type()); @@ -784,11 +797,11 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) { this->setp(__p, __p + __str_.size()); this->__pbump(__nout); __hm_ = this->pbase() + __hm; -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return traits_type::eof(); } -#endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS } __hm_ = std::max(this->pptr() + 1, __hm_); if (__mode_ & ios_base::in) { @@ -864,15 +877,16 @@ private: public: // [istringstream.cons] Constructors: - _LIBCPP_HIDE_FROM_ABI basic_istringstream() : basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {} + _LIBCPP_HIDE_FROM_ABI basic_istringstream() + : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(ios_base::in) {} _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(ios_base::openmode __wch) - : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) {} + : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in) {} _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in) - : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::in) {} + : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {} -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI basic_istringstream(ios_base::openmode __wch, const _Allocator& __a) : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::in, __a) {} @@ -892,9 +906,9 @@ public: _LIBCPP_HIDE_FROM_ABI explicit basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch = ios_base::in) : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::in) {} -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> @@ -911,12 +925,12 @@ public: _LIBCPP_HIDE_FROM_ABI basic_istringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) : basic_istream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::in, __a) {} -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 basic_istringstream(const basic_istringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_istringstream(basic_istringstream&& __rhs) : basic_istream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); + basic_istream<_CharT, _Traits>::set_rdbuf(std::addressof(__sb_)); } // [istringstream.assign] Assign and swap: @@ -933,18 +947,18 @@ public: // [istringstream.members] Member functions: _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { - return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); + return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_)); } -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); } -#else +# else _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); } _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); } -#endif +# endif -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> requires __is_allocator<_SAlloc>::value _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const { @@ -952,26 +966,26 @@ public: } _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) { __sb_.str(__s); } _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { rdbuf()->str(__t); } -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -999,15 +1013,16 @@ private: public: // [ostringstream.cons] Constructors: - _LIBCPP_HIDE_FROM_ABI basic_ostringstream() : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {} + _LIBCPP_HIDE_FROM_ABI basic_ostringstream() + : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(ios_base::out) {} _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(ios_base::openmode __wch) - : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) {} + : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out) {} _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out) - : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::out) {} + : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {} -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI basic_ostringstream(ios_base::openmode __wch, const _Allocator& __a) : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch | ios_base::out, __a) {} @@ -1028,9 +1043,9 @@ public: _LIBCPP_HIDE_FROM_ABI explicit basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch = ios_base::out) : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch | ios_base::out) {} -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> @@ -1047,12 +1062,12 @@ public: _LIBCPP_HIDE_FROM_ABI basic_ostringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which | ios_base::out, __a) {} -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 basic_ostringstream(const basic_ostringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_ostringstream(basic_ostringstream&& __rhs) : basic_ostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); + basic_ostream<_CharT, _Traits>::set_rdbuf(std::addressof(__sb_)); } // [ostringstream.assign] Assign and swap: @@ -1070,18 +1085,18 @@ public: // [ostringstream.members] Member functions: _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { - return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); + return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_)); } -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); } -#else +# else _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); } _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); } -#endif +# endif -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> requires __is_allocator<_SAlloc>::value _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const { @@ -1089,26 +1104,26 @@ public: } _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) { __sb_.str(__s); } _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { rdbuf()->str(__t); } -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -1137,16 +1152,16 @@ private: public: // [stringstream.cons] constructors _LIBCPP_HIDE_FROM_ABI basic_stringstream() - : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {} + : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(ios_base::in | ios_base::out) {} _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(ios_base::openmode __wch) - : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) {} + : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch) {} _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out) - : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch) {} + : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {} -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI basic_stringstream(ios_base::openmode __wch, const _Allocator& __a) : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__wch, __a) {} @@ -1168,9 +1183,9 @@ public: _LIBCPP_HIDE_FROM_ABI explicit basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __s, ios_base::openmode __wch = ios_base::out | ios_base::in) : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__s, __wch) {} -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> @@ -1188,12 +1203,12 @@ public: _LIBCPP_HIDE_FROM_ABI basic_stringstream(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a) : basic_iostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__t, __which, __a) {} -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 basic_stringstream(const basic_stringstream&) = delete; _LIBCPP_HIDE_FROM_ABI basic_stringstream(basic_stringstream&& __rhs) : basic_iostream<_CharT, _Traits>(std::move(__rhs)), __sb_(std::move(__rhs.__sb_)) { - basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); + basic_istream<_CharT, _Traits>::set_rdbuf(std::addressof(__sb_)); } // [stringstream.assign] Assign and swap: @@ -1210,18 +1225,18 @@ public: // [stringstream.members] Member functions: _LIBCPP_HIDE_FROM_ABI basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { - return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); + return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(std::addressof(__sb_)); } -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) +# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_BUILDING_LIBRARY) _LIBCPP_HIDE_FROM_ABI string_type str() const { return __sb_.str(); } -#else +# else _LIBCPP_HIDE_FROM_ABI string_type str() const& { return __sb_.str(); } _LIBCPP_HIDE_FROM_ABI string_type str() && { return std::move(__sb_).str(); } -#endif +# endif -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> requires __is_allocator<_SAlloc>::value _LIBCPP_HIDE_FROM_ABI basic_string<char_type, traits_type, _SAlloc> str(const _SAlloc& __sa) const { @@ -1229,26 +1244,26 @@ public: } _LIBCPP_HIDE_FROM_ABI basic_string_view<char_type, traits_type> view() const noexcept { return __sb_.view(); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI void str(const string_type& __s) { __sb_.str(__s); } -#if _LIBCPP_STD_VER >= 20 +# if _LIBCPP_STD_VER >= 20 template <class _SAlloc> _LIBCPP_HIDE_FROM_ABI void str(const basic_string<char_type, traits_type, _SAlloc>& __s) { __sb_.str(__s); } _LIBCPP_HIDE_FROM_ABI void str(string_type&& __s) { __sb_.str(std::move(__s)); } -#endif // _LIBCPP_STD_VER >= 20 +# endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER >= 26 +# if _LIBCPP_STD_VER >= 26 template <class _Tp> requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>> _LIBCPP_HIDE_FROM_ABI void str(const _Tp& __t) { rdbuf()->str(__t); } -#endif // _LIBCPP_STD_VER >= 26 +# endif // _LIBCPP_STD_VER >= 26 }; template <class _CharT, class _Traits, class _Allocator> @@ -1257,17 +1272,19 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, basic_stringstream<_C __x.swap(__y); } -#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 +# if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>; -#endif +# endif _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !_LIBCPP_HAS_NO_LOCALIZATION + #if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <ostream> # include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/stack b/contrib/libs/cxxsupp/libcxx/include/stack index 90f8933cca3..f75769f8a42 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stack +++ b/contrib/libs/cxxsupp/libcxx/include/stack @@ -231,7 +231,7 @@ public: #endif - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); } _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); } _LIBCPP_HIDE_FROM_ABI reference top() { return c.back(); } _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.back(); } @@ -273,7 +273,7 @@ public: swap(c, __s.c); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; } template <class _T1, class _OtherContainer> friend bool operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y); diff --git a/contrib/libs/cxxsupp/libcxx/include/stdatomic.h b/contrib/libs/cxxsupp/libcxx/include/stdatomic.h index 79772eb7fce..3206f7da8c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stdatomic.h +++ b/contrib/libs/cxxsupp/libcxx/include/stdatomic.h @@ -103,6 +103,8 @@ using std::atomic_fetch_sub // see below using std::atomic_fetch_sub_explicit // see below using std::atomic_fetch_or // see below using std::atomic_fetch_or_explicit // see below +using std::atomic_fetch_xor // see below +using std::atomic_fetch_xor_explicit // see below using std::atomic_fetch_and // see below using std::atomic_fetch_and_explicit // see below using std::atomic_flag_test_and_set // see below @@ -121,7 +123,7 @@ using std::atomic_signal_fence // see below # pragma GCC system_header #endif -#if defined(__cplusplus) && _LIBCPP_STD_VER >= 23 +#if defined(__cplusplus) # include <atomic> # include <version> @@ -154,10 +156,14 @@ using std::atomic_long _LIBCPP_USING_IF_EXISTS; using std::atomic_ulong _LIBCPP_USING_IF_EXISTS; using std::atomic_llong _LIBCPP_USING_IF_EXISTS; using std::atomic_ullong _LIBCPP_USING_IF_EXISTS; +# ifndef _LIBCPP_HAS_NO_CHAR8_T using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS; +# endif using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS; using std::atomic_char32_t _LIBCPP_USING_IF_EXISTS; +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS using std::atomic_wchar_t _LIBCPP_USING_IF_EXISTS; +# endif using std::atomic_int8_t _LIBCPP_USING_IF_EXISTS; using std::atomic_uint8_t _LIBCPP_USING_IF_EXISTS; @@ -204,6 +210,8 @@ using std::atomic_fetch_add_explicit _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_and _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_and_explicit _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_or _LIBCPP_USING_IF_EXISTS; +using std::atomic_fetch_xor_explicit _LIBCPP_USING_IF_EXISTS; +using std::atomic_fetch_xor _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_or_explicit _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_sub _LIBCPP_USING_IF_EXISTS; using std::atomic_fetch_sub_explicit _LIBCPP_USING_IF_EXISTS; @@ -220,16 +228,12 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS; using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS; using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) +#else -// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking -// the header. We do this because Clang has historically shipped a <stdatomic.h> -// header that would be available in all Standard modes, and we don't want to -// break that use case. # if __has_include_next(<stdatomic.h>) # include_next <stdatomic.h> # endif -#endif // defined(__cplusplus) && _LIBCPP_STD_VER >= 23 +#endif // defined(__cplusplus) #endif // _LIBCPP_STDATOMIC_H diff --git a/contrib/libs/cxxsupp/libcxx/include/stdexcept b/contrib/libs/cxxsupp/libcxx/include/stdexcept index 853c185187c..bdfc27aeac3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stdexcept +++ b/contrib/libs/cxxsupp/libcxx/include/stdexcept @@ -209,9 +209,9 @@ public: _LIBCPP_BEGIN_NAMESPACE_STD // in the dylib -_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*); +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*); -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw logic_error(__msg); #else @@ -219,7 +219,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const cha #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw domain_error(__msg); #else @@ -227,7 +227,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const ch #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw invalid_argument(__msg); #else @@ -235,7 +235,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(cons #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw length_error(__msg); #else @@ -243,7 +243,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const ch #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw out_of_range(__msg); #else @@ -251,7 +251,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const ch #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw range_error(__msg); #else @@ -259,7 +259,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const cha #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw overflow_error(__msg); #else @@ -267,7 +267,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const #endif } -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw underflow_error(__msg); #else diff --git a/contrib/libs/cxxsupp/libcxx/include/stdlib.h b/contrib/libs/cxxsupp/libcxx/include/stdlib.h index a74344d4915..358b10c0392 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stdlib.h +++ b/contrib/libs/cxxsupp/libcxx/include/stdlib.h @@ -110,19 +110,19 @@ extern "C++" { // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined # if !defined(_LIBCPP_MSVCRT) -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } # endif // !defined(_LIBCPP_MSVCRT) -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float abs(float __lcpp_x) _NOEXCEPT { return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double abs(double __lcpp_x) _NOEXCEPT { return __builtin_fabs(__lcpp_x); } -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT { +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double abs(long double __lcpp_x) _NOEXCEPT { return __builtin_fabsl(__lcpp_x); } diff --git a/contrib/libs/cxxsupp/libcxx/include/stop_token b/contrib/libs/cxxsupp/libcxx/include/stop_token index fee195f9d63..d4e651d9541 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stop_token +++ b/contrib/libs/cxxsupp/libcxx/include/stop_token @@ -33,18 +33,21 @@ namespace std { #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<stop_token> is not supported since libc++ has been configured without support for threads." -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) -#include <__stop_token/stop_callback.h> -#include <__stop_token/stop_source.h> -#include <__stop_token/stop_token.h> -#include <version> +# if _LIBCPP_STD_VER >= 20 +# include <__stop_token/stop_callback.h> +# include <__stop_token/stop_source.h> +# include <__stop_token/stop_token.h> +# endif -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +#endif // !defined(_LIBCPP_HAS_NO_THREADS) #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <iosfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/streambuf b/contrib/libs/cxxsupp/libcxx/include/streambuf index 5a3c17ef7c9..906340ef033 100644 --- a/contrib/libs/cxxsupp/libcxx/include/streambuf +++ b/contrib/libs/cxxsupp/libcxx/include/streambuf @@ -107,23 +107,26 @@ protected: */ -#include <__assert> #include <__config> -#include <__fwd/streambuf.h> -#include <__locale> -#include <__type_traits/is_same.h> -#include <__utility/is_valid_range.h> -#include <climits> -#include <ios> -#include <iosfwd> -#include <version> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__assert> +# include <__fwd/streambuf.h> +# include <__locale> +# include <__type_traits/is_same.h> +# include <__utility/is_valid_range.h> +# include <climits> +# include <ios> +# include <iosfwd> +# include <version> + +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD @@ -430,14 +433,16 @@ typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Tra extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; -#endif +# endif _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdint> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 74c06906174..5b960cd1ca6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -409,6 +409,24 @@ basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs); // constexpr since C++20 template<class charT, class traits, class Allocator> + constexpr basic_string<charT, traits, Allocator> + operator+(const basic_string<charT, traits, Allocator>& lhs, + type_identity_t<basic_string_view<charT, traits>> rhs); // Since C++26 +template<class charT, class traits, class Allocator> + constexpr basic_string<charT, traits, Allocator> + operator+(basic_string<charT, traits, Allocator>&& lhs, + type_identity_t<basic_string_view<charT, traits>> rhs); // Since C++26 +template<class charT, class traits, class Allocator> + constexpr basic_string<charT, traits, Allocator> + operator+(type_identity_t<basic_string_view<charT, traits>> lhs, + const basic_string<charT, traits, Allocator>& rhs); // Since C++26 +template<class charT, class traits, class Allocator> + constexpr basic_string<charT, traits, Allocator> + operator+(type_identity_t<basic_string_view<charT, traits>> lhs, + basic_string<charT, traits, Allocator>&& rhs); // Since C++26 + + +template<class charT, class traits, class Allocator> bool operator==(const basic_string<charT, traits, Allocator>& lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20 @@ -581,6 +599,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__functional/unary_function.h> #include <__fwd/string.h> #include <__ios/fpos.h> +#include <__iterator/bounded_iter.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> @@ -591,6 +610,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__memory/allocator_traits.h> #include <__memory/compressed_pair.h> #include <__memory/construct_at.h> +#include <__memory/noexcept_move_assign_container.h> #include <__memory/pointer_traits.h> #include <__memory/swap_allocator.h> #include <__memory_resource/polymorphic_allocator.h> @@ -602,6 +622,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__string/char_traits.h> #include <__string/extern_template_lists.h> #include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_array.h> #include <__type_traits/is_convertible.h> @@ -611,7 +632,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len ); #include <__type_traits/is_standard_layout.h> #include <__type_traits/is_trivial.h> #include <__type_traits/is_trivially_relocatable.h> -#include <__type_traits/noexcept_move_assign_container.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/void_t.h> #include <__utility/auto_cast.h> @@ -688,6 +708,28 @@ template <class _CharT, class _Traits, class _Allocator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); +#if _LIBCPP_STD_VER >= 26 + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + type_identity_t<basic_string_view<_CharT, _Traits>> __rhs); + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, type_identity_t<basic_string_view<_CharT, _Traits>> __rhs); + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(type_identity_t<basic_string_view<_CharT, _Traits>> __lhs, + const basic_string<_CharT, _Traits, _Allocator>& __rhs); + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(type_identity_t<basic_string_view<_CharT, _Traits>> __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs); + +#endif + extern template _LIBCPP_EXPORTED_FROM_ABI string operator+ <char, char_traits<char>, allocator<char> >(char const*, string const&); @@ -708,6 +750,14 @@ struct __can_be_converted_to_string_view struct __uninitialized_size_tag {}; struct __init_with_sentinel_tag {}; +template <size_t _PaddingSize> +struct __padding { + char __padding_[_PaddingSize]; +}; + +template <> +struct __padding<0> {}; + template <class _CharT, class _Traits, class _Allocator> class basic_string { private: @@ -786,8 +836,13 @@ public: #if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 typedef pointer iterator; typedef const_pointer const_iterator; +#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING) + // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's + // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is + // considered contiguous. + typedef __bounded_iter<__wrap_iter<pointer> > iterator; + typedef __bounded_iter<__wrap_iter<const_pointer> > const_iterator; #else - // TODO: Implement iterator bounds checking without requiring the global database. typedef __wrap_iter<pointer> iterator; typedef __wrap_iter<const_pointer> const_iterator; #endif @@ -810,7 +865,7 @@ private: struct __short { value_type __data_[__min_cap]; - unsigned char __padding_[sizeof(value_type) - 1]; + _LIBCPP_NO_UNIQUE_ADDRESS __padding<sizeof(value_type) - 1> __padding_; unsigned char __size_ : 7; unsigned char __is_long_ : 1; }; @@ -862,7 +917,7 @@ private: unsigned char __is_long_ : 1; unsigned char __size_ : 7; }; - char __padding_[sizeof(value_type) - 1]; + _LIBCPP_NO_UNIQUE_ADDRESS __padding<sizeof(value_type) - 1> __padding_; value_type __data_[__min_cap]; }; @@ -875,18 +930,18 @@ private: __long __l; }; - __compressed_pair<__rep, allocator_type> __r_; + _LIBCPP_COMPRESSED_PAIR(__rep, __rep_, allocator_type, __alloc_); // Construct a string with the given allocator and enough storage to hold `__size` characters, but // don't initialize the characters. The contents of the string, including the null terminator, must be // initialized separately. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( __uninitialized_size_tag, size_type __size, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { if (__size > max_size()) __throw_length_error(); if (__fits_in_sso(__size)) { - __r_.first() = __rep(); + __rep_ = __rep(); __set_short_size(__size); } else { auto __capacity = __recommend(__size) + 1; @@ -902,14 +957,37 @@ private: template <class _Iter, class _Sent> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(__init_with_sentinel_tag, _Iter __first, _Sent __last, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __init_with_sentinel(std::move(__first), std::move(__last)); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { return iterator(__p); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) { +#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING + // Bound the iterator according to the size (and not the capacity, unlike vector). + // + // By the Standard, string iterators are generally not guaranteed to stay valid when the container is modified, + // regardless of whether reallocation occurs. This allows us to check for out-of-bounds accesses using logical size, + // a stricter check, since correct code can never rely on being able to access newly-added elements via an existing + // iterator. + return std::__make_bounded_iter( + std::__wrap_iter<pointer>(__p), + std::__wrap_iter<pointer>(__get_pointer()), + std::__wrap_iter<pointer>(__get_pointer() + size())); +#else + return iterator(__p); +#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING + } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const { +#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING + // Bound the iterator according to the size (and not the capacity, unlike vector). + return std::__make_bounded_iter( + std::__wrap_iter<const_pointer>(__p), + std::__wrap_iter<const_pointer>(__get_pointer()), + std::__wrap_iter<const_pointer>(__get_pointer() + size())); +#else return const_iterator(__p); +#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING } public: @@ -917,7 +995,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __r_(__value_init_tag(), __default_init_tag()) { + : __rep_() { __annotate_new(0); } @@ -927,14 +1005,14 @@ public: #else _NOEXCEPT #endif - : __r_(__value_init_tag(), __a) { + : __rep_(), __alloc_(__a) { __annotate_new(0); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str) - : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) { + : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc())) { if (!__str.__is_long()) { - __r_.first() = __str.__r_.first(); + __rep_ = __str.__rep_; __annotate_new(__get_short_size()); } else __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); @@ -942,9 +1020,9 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { if (!__str.__is_long()) { - __r_.first() = __str.__r_.first(); + __rep_ = __str.__rep_; __annotate_new(__get_short_size()); } else __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); @@ -960,45 +1038,45 @@ public: // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first. // __str's memory needs to be unpoisoned only in the case where it's a short string. - : __r_([](basic_string& __s) -> decltype(__s.__r_)&& { + : __rep_([](basic_string& __s) -> decltype(__s.__rep_)&& { if (!__s.__is_long()) __s.__annotate_delete(); - return std::move(__s.__r_); - }(__str)) { - __str.__r_.first() = __rep(); + return std::move(__s.__rep_); + }(__str)), + __alloc_(std::move(__str.__alloc_)) { + __str.__rep_ = __rep(); __str.__annotate_new(0); if (!__is_long()) __annotate_new(size()); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { if (__str.__is_long() && __a != __str.__alloc()) // copy, not move __init(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); else { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); if (!__str.__is_long()) __str.__annotate_delete(); - __r_.first() = __str.__r_.first(); - __str.__r_.first() = __rep(); + __rep_ = __str.__rep_; + __str.__rep_ = __rep(); __str.__annotate_new(0); - if (!__is_long() && this != &__str) + if (!__is_long() && this != std::addressof(__str)) __annotate_new(size()); } } #endif // _LIBCPP_CXX03_LANG template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) - : __r_(__default_init_tag(), __default_init_tag()) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) { _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*) detected nullptr"); __init(__s, traits_type::length(__s)); } template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); __init(__s, traits_type::length(__s)); } @@ -1008,8 +1086,7 @@ public: #endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(nullptr_t, size_t) = delete; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) - : __r_(__default_init_tag(), __default_init_tag()) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) { _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); __init(__s, __n); } @@ -1018,15 +1095,12 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); __init(__s, __n); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) - : __r_(__default_init_tag(), __default_init_tag()) { - __init(__n, __c); - } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) { __init(__n, __c); } #if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr basic_string( @@ -1035,7 +1109,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr basic_string( basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator()) - : __r_(__default_init_tag(), __alloc) { + : __alloc_(__alloc) { if (__pos > __str.size()) __throw_out_of_range(); @@ -1051,13 +1125,13 @@ public: template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __init(__n, __c); } _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) __throw_out_of_range(); @@ -1066,7 +1140,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a = _Allocator()) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) __throw_out_of_range(); @@ -1079,7 +1153,7 @@ public: int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __self_view __sv0 = __t; __self_view __sv = __sv0.substr(__pos, __n); __init(__sv.data(), __sv.size()); @@ -1089,8 +1163,8 @@ public: __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, int> = 0> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) - : __r_(__default_init_tag(), __default_init_tag()) { + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) { __self_view __sv = __t; __init(__sv.data(), __sv.size()); } @@ -1101,21 +1175,20 @@ public: int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __self_view __sv = __t; __init(__sv.data(), __sv.size()); } template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) - : __r_(__default_init_tag(), __default_init_tag()) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) { __init(__first, __last); } template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __init(__first, __last); } @@ -1123,7 +1196,7 @@ public: template <_ContainerCompatibleRange<_CharT> _Range> _LIBCPP_HIDE_FROM_ABI constexpr basic_string( from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { __init_with_size(ranges::begin(__range), ranges::end(__range), ranges::distance(__range)); } else { @@ -1133,13 +1206,12 @@ public: #endif #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) - : __r_(__default_init_tag(), __default_init_tag()) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) { __init(__il.begin(), __il.end()); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a) - : __r_(__default_init_tag(), __a) { + : __alloc_(__a) { __init(__il.begin(), __il.end()); } #endif // _LIBCPP_CXX03_LANG @@ -1151,7 +1223,7 @@ public: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT { - return __self_view(data(), size()); + return __self_view(typename __self_view::__assume_valid(), data(), size()); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string& @@ -1277,7 +1349,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT; - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT { return size() == 0; } @@ -1423,8 +1495,8 @@ public: size_type __old_sz = __str.size(); if (!__str.__is_long()) __str.__annotate_delete(); - __r_.first() = __str.__r_.first(); - __str.__r_.first() = __rep(); + __rep_ = __str.__rep_; + __str.__rep_ = __rep(); __str.__annotate_new(0); _Traits::move(data(), data() + __pos, __len); @@ -1779,7 +1851,7 @@ public: #if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept { - return __self_view(data(), size()).starts_with(__sv); + return __self_view(typename __self_view::__assume_valid(), data(), size()).starts_with(__sv); } constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept { @@ -1791,7 +1863,7 @@ public: } constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept { - return __self_view(data(), size()).ends_with(__sv); + return __self_view(typename __self_view::__assume_valid(), data(), size()).ends_with(__sv); } constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept { @@ -1805,15 +1877,15 @@ public: #if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept { - return __self_view(data(), size()).contains(__sv); + return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__sv); } constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept { - return __self_view(data(), size()).contains(__c); + return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__c); } constexpr _LIBCPP_HIDE_FROM_ABI bool contains(const value_type* __s) const { - return __self_view(data(), size()).contains(__s); + return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__s); } #endif @@ -1831,10 +1903,10 @@ private: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS bool __is_long() const _NOEXCEPT { - if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) { - return __r_.first().__l.__is_long_; + if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__rep_.__l.__is_long_)) { + return __rep_.__l.__is_long_; } - return __r_.first().__s.__is_long_; + return __rep_.__s.__is_long_; } static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) { @@ -1858,6 +1930,23 @@ private: template <class _Iterator, class _Sentinel> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __first, _Sentinel __last); + // Copy [__first, __last) into [__dest, __dest + (__last - __first)). Assumes that the ranges don't overlap. + template <class _ForwardIter, class _Sent> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static value_type* + __copy_non_overlapping_range(_ForwardIter __first, _Sent __last, value_type* __dest) { +#ifndef _LIBCPP_CXX03_LANG + if constexpr (__libcpp_is_contiguous_iterator<_ForwardIter>::value && + is_same<value_type, __iter_value_type<_ForwardIter>>::value && is_same<_ForwardIter, _Sent>::value) { + traits_type::copy(__dest, std::__to_address(__first), __last - __first); + return __dest + (__last - __first); + } +#endif + + for (; __first != __last; ++__first) + traits_type::assign(*__dest++, *__first); + return __dest; + } + template <class _ForwardIterator, class _Sentinel> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator __insert_from_safe_copy(size_type __n, size_type __ip, _ForwardIterator __first, _Sentinel __last) { @@ -1877,8 +1966,7 @@ private: __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); - for (__p += __ip; __first != __last; ++__p, ++__first) - traits_type::assign(*__p, *__first); + __copy_non_overlapping_range(__first, __last, __p + __ip); return begin() + __ip; } @@ -1887,27 +1975,27 @@ private: _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n); - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc() _NOEXCEPT { return __alloc_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __alloc_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void __set_short_size(size_type __s) _NOEXCEPT { _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity"); - __r_.first().__s.__size_ = __s; - __r_.first().__s.__is_long_ = false; + __rep_.__s.__size_ = __s; + __rep_.__s.__is_long_ = false; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS size_type __get_short_size() const _NOEXCEPT { - _LIBCPP_ASSERT_INTERNAL(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size"); - return __r_.first().__s.__size_; + _LIBCPP_ASSERT_INTERNAL(!__rep_.__s.__is_long_, "String has to be short when trying to get the short size"); + return __rep_.__s.__size_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_size(size_type __s) _NOEXCEPT { - __r_.first().__l.__size_ = __s; + __rep_.__l.__size_ = __s; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_size() const _NOEXCEPT { - return __r_.first().__l.__size_; + return __rep_.__l.__size_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_size(size_type __s) _NOEXCEPT { if (__is_long()) @@ -1917,31 +2005,36 @@ private: } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap(size_type __s) _NOEXCEPT { - __r_.first().__l.__cap_ = __s / __endian_factor; - __r_.first().__l.__is_long_ = true; + __rep_.__l.__cap_ = __s / __endian_factor; + __rep_.__l.__is_long_ = true; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap() const _NOEXCEPT { - return __r_.first().__l.__cap_ * __endian_factor; + return __rep_.__l.__cap_ * __endian_factor; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_pointer(pointer __p) _NOEXCEPT { - __r_.first().__l.__data_ = __p; + __rep_.__l.__data_ = __p; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT { - return _LIBCPP_ASAN_VOLATILE_WRAPPER(__r_.first().__l.__data_); + return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT { - return _LIBCPP_ASAN_VOLATILE_WRAPPER(__r_.first().__l.__data_); + return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS pointer __get_short_pointer() _NOEXCEPT { - return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0])); + return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<pointer>::pointer_to(__rep_.__s.__data_[0])); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS const_pointer __get_short_pointer() const _NOEXCEPT { - return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0])); + return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<const_pointer>::pointer_to(__rep_.__s.__data_[0])); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT { return __is_long() ? __get_long_pointer() : __get_short_pointer(); } @@ -1955,6 +2048,11 @@ private: (void)__old_mid; (void)__new_mid; #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN) +# if defined(__APPLE__) + // TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099) + if (!__is_long()) + return; +# endif std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid); #endif } @@ -2165,11 +2263,11 @@ private: return std::__is_pointer_in_range(data(), data() + size() + 1, std::addressof(__v)); } - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("basic_string"); } - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("basic_string"); } @@ -2178,6 +2276,14 @@ private: friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(value_type, const basic_string&); friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, const value_type*); friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator+ <>(const basic_string&, value_type); +#if _LIBCPP_STD_VER >= 26 + friend constexpr basic_string operator+ <>(const basic_string&, type_identity_t<__self_view>); + friend constexpr basic_string operator+ <>(type_identity_t<__self_view>, const basic_string&); +#endif + + template <class _CharT2, class _Traits2, class _Allocator2> + friend inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool + operator==(const basic_string<_CharT2, _Traits2, _Allocator2>&, const _CharT2*) _NOEXCEPT; }; // These declarations must appear before any functions are implicitly used @@ -2233,7 +2339,7 @@ template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); if (__reserve > max_size()) __throw_length_error(); pointer __p; @@ -2257,7 +2363,7 @@ template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); if (__sz > max_size()) __throw_length_error(); pointer __p; @@ -2281,7 +2387,7 @@ template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value_type* __s, size_type __sz) { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); pointer __p; if (__fits_in_sso(__sz)) { @@ -2304,7 +2410,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); if (__n > max_size()) __throw_length_error(); @@ -2336,7 +2442,7 @@ template <class _CharT, class _Traits, class _Allocator> template <class _InputIterator, class _Sentinel> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator __first, _Sentinel __last) { - __r_.first() = __rep(); + __rep_ = __rep(); __annotate_new(0); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS @@ -2367,7 +2473,7 @@ template <class _InputIterator, class _Sentinel> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz) { if (__libcpp_is_constant_evaluated()) - __r_.first() = __rep(); + __rep_ = __rep(); if (__sz > max_size()) __throw_length_error(); @@ -2389,9 +2495,8 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif // _LIBCPP_HAS_NO_EXCEPTIONS - for (; __first != __last; ++__first, (void)++__p) - traits_type::assign(*__p, *__first); - traits_type::assign(*__p, value_type()); + auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__p)); + traits_type::assign(*__end, value_type()); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { if (__is_long()) @@ -2588,7 +2693,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) size_type __old_size = __get_short_size(); if (__get_short_size() < __str.__get_short_size()) __annotate_increase(__str.__get_short_size() - __get_short_size()); - __r_.first() = __str.__r_.first(); + __rep_ = __str.__rep_; if (__old_size > __get_short_size()) __annotate_shrink(__old_size); } else { @@ -2636,11 +2741,11 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr bool __str_was_short = !__str.__is_long(); __move_assign_alloc(__str); - __r_.first() = __str.__r_.first(); + __rep_ = __str.__rep_; __str.__set_short_size(0); traits_type::assign(__str.__get_short_pointer()[0], value_type()); - if (__str_was_short && this != &__str) + if (__str_was_short && this != std::addressof(__str)) __str.__annotate_shrink(__str_old_size); else // ASan annotations: was long, so object memory is unpoisoned as new. @@ -2654,7 +2759,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr // invariants hold (so functions without preconditions, such as the assignment operator, // can be safely used on the object after it was moved from):" // Quote: "v = std::move(v); // the value of v is unspecified" - if (!__is_long() && &__str != this) + if (!__is_long() && std::addressof(__str) != this) // If it is long string, delete was never called on original __str's buffer. __annotate_new(__get_short_size()); } @@ -2857,10 +2962,8 @@ basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _For if (__cap - __sz < __n) __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0); __annotate_increase(__n); - pointer __p = __get_pointer() + __sz; - for (; __first != __last; ++__p, (void)++__first) - traits_type::assign(*__p, *__first); - traits_type::assign(*__p, value_type()); + auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz)); + traits_type::assign(*__end, value_type()); __set_size(__sz + __n); } else { const basic_string __temp(__first, __last, __alloc()); @@ -3293,23 +3396,34 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target __p = __get_long_pointer(); } else { if (__target_capacity > __cap) { + // Extend + // - called from reserve should propagate the exception thrown. auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1); __new_data = __allocation.ptr; __target_capacity = __allocation.count - 1; } else { + // Shrink + // - called from shrink_to_fit should not throw. + // - called from reserve may throw but is not required to. #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif // _LIBCPP_HAS_NO_EXCEPTIONS auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1); + + // The Standard mandates shrink_to_fit() does not increase the capacity. + // With equal capacity keep the existing buffer. This avoids extra work + // due to swapping the elements. + if (__allocation.count - 1 > __target_capacity) { + __alloc_traits::deallocate(__alloc(), __allocation.ptr, __allocation.count); + __annotate_new(__sz); // Undoes the __annotate_delete() + return; + } __new_data = __allocation.ptr; __target_capacity = __allocation.count - 1; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return; } -#else // _LIBCPP_HAS_NO_EXCEPTIONS - if (__new_data == nullptr) - return; #endif // _LIBCPP_HAS_NO_EXCEPTIONS } __begin_lifetime(__new_data, __target_capacity + 1); @@ -3370,26 +3484,18 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat "swapping non-equal allocators"); if (!__is_long()) __annotate_delete(); - if (this != &__str && !__str.__is_long()) + if (this != std::addressof(__str) && !__str.__is_long()) __str.__annotate_delete(); - std::swap(__r_.first(), __str.__r_.first()); + std::swap(__rep_, __str.__rep_); std::__swap_allocator(__alloc(), __str.__alloc()); if (!__is_long()) __annotate_new(__get_short_size()); - if (this != &__str && !__str.__is_long()) + if (this != std::addressof(__str) && !__str.__is_long()) __str.__annotate_new(__str.__get_short_size()); } // find -template <class _Traits> -struct _LIBCPP_HIDDEN __traits_eq { - typedef typename _Traits::char_type char_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT { - return _Traits::eq(__x, __y); - } -}; - template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3735,7 +3841,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat if (__is_long()) { __annotate_delete(); __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); - __r_.first() = __rep(); + __rep_ = __rep(); } } @@ -3779,16 +3885,18 @@ operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& template <class _CharT, class _Traits, class _Allocator> inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT { -#if _LIBCPP_STD_VER >= 20 - return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); -#else - typedef basic_string<_CharT, _Traits, _Allocator> _String; _LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr"); + + using _String = basic_string<_CharT, _Traits, _Allocator>; + size_t __rhs_len = _Traits::length(__rhs); + if (__builtin_constant_p(__rhs_len) && !_String::__fits_in_sso(__rhs_len)) { + if (!__lhs.__is_long()) + return false; + } if (__rhs_len != __lhs.size()) return false; return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; -#endif } #if _LIBCPP_STD_VER >= 20 @@ -4035,6 +4143,60 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) { #endif // _LIBCPP_CXX03_LANG +#if _LIBCPP_STD_VER >= 26 + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, + type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) { + using _String = basic_string<_CharT, _Traits, _Allocator>; + typename _String::size_type __lhs_sz = __lhs.size(); + typename _String::size_type __rhs_sz = __rhs.size(); + _String __r(__uninitialized_size_tag(), + __lhs_sz + __rhs_sz, + _String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); + auto __ptr = std::__to_address(__r.__get_pointer()); + _Traits::copy(__ptr, __lhs.data(), __lhs_sz); + _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz); + _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT()); + return __r; +} + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, + type_identity_t<basic_string_view<_CharT, _Traits>> __rhs) { + __lhs.append(__rhs); + return std::move(__lhs); +} + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(type_identity_t<basic_string_view<_CharT, _Traits>> __lhs, + const basic_string<_CharT, _Traits, _Allocator>& __rhs) { + using _String = basic_string<_CharT, _Traits, _Allocator>; + typename _String::size_type __lhs_sz = __lhs.size(); + typename _String::size_type __rhs_sz = __rhs.size(); + _String __r(__uninitialized_size_tag(), + __lhs_sz + __rhs_sz, + _String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator())); + auto __ptr = std::__to_address(__r.__get_pointer()); + _Traits::copy(__ptr, __lhs.data(), __lhs_sz); + _Traits::copy(__ptr + __lhs_sz, __rhs.data(), __rhs_sz); + _Traits::assign(__ptr + __lhs_sz + __rhs_sz, 1, _CharT()); + return __r; +} + +template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator> +operator+(type_identity_t<basic_string_view<_CharT, _Traits>> __lhs, + basic_string<_CharT, _Traits, _Allocator>&& __rhs) { + __rhs.insert(0, __lhs); + return std::move(__rhs); +} + +#endif // _LIBCPP_STD_VER >= 26 + // swap template <class _CharT, class _Traits, class _Allocator> diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index 058ca721840..69854c17065 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -210,6 +210,8 @@ namespace std { #include <__config> #include <__functional/hash.h> #include <__functional/unary_function.h> +#include <__fwd/ostream.h> +#include <__fwd/string.h> #include <__fwd/string_view.h> #include <__iterator/bounded_iter.h> #include <__iterator/concepts.h> @@ -396,7 +398,7 @@ public: return numeric_limits<size_type>::max() / sizeof(value_type); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size_ == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size_ == 0; } // [string.view.access], element access _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __pos) const _NOEXCEPT { @@ -449,8 +451,11 @@ public: } _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI basic_string_view substr(size_type __pos = 0, size_type __n = npos) const { + // Use the `__assume_valid` form of the constructor to avoid an unnecessary check. Any substring of a view is a + // valid view. In particular, `size()` is known to be smaller than `numeric_limits<difference_type>::max()`, so the + // new size is also smaller. See also https://github.com/llvm/llvm-project/issues/91634. return __pos > size() ? (__throw_out_of_range("string_view::substr"), basic_string_view()) - : basic_string_view(data() + __pos, std::min(__n, size() - __pos)); + : basic_string_view(__assume_valid(), data() + __pos, std::min(__n, size() - __pos)); } _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT { @@ -675,8 +680,21 @@ public: #endif private: + struct __assume_valid {}; + + // This is the same as the pointer and length constructor, but without the additional hardening checks. It is intended + // for use within the class, when the class invariants already guarantee the resulting object is valid. The compiler + // usually cannot eliminate the redundant checks because it does not know class invariants. + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI + basic_string_view(__assume_valid, const _CharT* __s, size_type __len) _NOEXCEPT + : __data_(__s), + __size_(__len) {} + const value_type* __data_; size_type __size_; + + template <class, class, class> + friend class basic_string; }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_string_view); diff --git a/contrib/libs/cxxsupp/libcxx/include/syncstream b/contrib/libs/cxxsupp/libcxx/include/syncstream index e6f35b6f428..a2e1c7edadc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/syncstream +++ b/contrib/libs/cxxsupp/libcxx/include/syncstream @@ -46,7 +46,9 @@ namespace std { using streambuf_type = basic_streambuf<charT, traits>; // [syncstream.syncbuf.cons], construction and destruction - explicit basic_syncbuf(streambuf_type* obuf = nullptr) + basic_syncbuf() + : basic_syncbuf(nullptr) {} + explicit basic_syncbuf(streambuf_type* obuf) : basic_syncbuf(obuf, Allocator()) {} basic_syncbuf(streambuf_type*, const Allocator&); basic_syncbuf(basic_syncbuf&&); @@ -116,33 +118,36 @@ namespace std { */ #include <__config> -#include <__utility/move.h> -#include <ios> -#include <iosfwd> // required for declaration of default arguments -#include <streambuf> -#include <string> - -#ifndef _LIBCPP_HAS_NO_THREADS -# include <map> -# include <mutex> -# include <shared_mutex> -#endif + +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) + +# include <__utility/move.h> +# include <ios> +# include <iosfwd> // required for declaration of default arguments +# include <streambuf> +# include <string> + +# ifndef _LIBCPP_HAS_NO_THREADS +# include <map> +# include <mutex> +# include <shared_mutex> +# endif // standard-mandated includes // [syncstream.syn] -#include <ostream> +# include <ostream> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +# include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) // [syncstream.syncbuf.overview]/1 // Class template basic_syncbuf stores character data written to it, @@ -155,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // // This helper singleton is used to implement the required // synchronisation guarantees. -# ifndef _LIBCPP_HAS_NO_THREADS +# ifndef _LIBCPP_HAS_NO_THREADS class __wrapped_streambuf_mutex { _LIBCPP_HIDE_FROM_ABI __wrapped_streambuf_mutex() = default; @@ -228,7 +233,7 @@ private: return __it; } }; -# endif // _LIBCPP_HAS_NO_THREADS +# endif // _LIBCPP_HAS_NO_THREADS // basic_syncbuf @@ -253,8 +258,9 @@ public: // [syncstream.syncbuf.cons], construction and destruction - _LIBCPP_HIDE_FROM_ABI explicit basic_syncbuf(streambuf_type* __obuf = nullptr) - : basic_syncbuf(__obuf, _Allocator()) {} + _LIBCPP_HIDE_FROM_ABI basic_syncbuf() : basic_syncbuf(nullptr) {} + + _LIBCPP_HIDE_FROM_ABI explicit basic_syncbuf(streambuf_type* __obuf) : basic_syncbuf(__obuf, _Allocator()) {} _LIBCPP_HIDE_FROM_ABI basic_syncbuf(streambuf_type* __obuf, _Allocator const& __alloc) : __wrapped_(__obuf), __str_(__alloc) { @@ -267,14 +273,14 @@ public: } _LIBCPP_HIDE_FROM_ABI ~basic_syncbuf() { -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS emit(); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -# endif // _LIBCPP_HAS_NO_EXCEPTIONS +# endif // _LIBCPP_HAS_NO_EXCEPTIONS __dec_reference(); } @@ -331,9 +337,9 @@ protected: return traits_type::not_eof(__c); if (this->pptr() == this->epptr()) { -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif +# endif size_t __size = __str_.size(); __str_.resize(__str_.capacity() + 1); _LIBCPP_ASSERT_INTERNAL(__str_.size() > __size, "the buffer hasn't grown"); @@ -342,11 +348,11 @@ protected: this->setp(__p, __p + __str_.size()); this->pbump(__size); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return traits_type::eof(); } -# endif +# endif } return this->sputc(traits_type::to_char_type(__c)); @@ -358,7 +364,7 @@ private: // TODO Use a more generic buffer. // That buffer should be light with almost no additional headers. Then // it can be use here, the __retarget_buffer, and place that use - // the now deprecated get_temporary_buffer + // the now removed get_temporary_buffer basic_string<_CharT, _Traits, _Allocator> __str_; bool __emit_on_sync_{false}; @@ -367,9 +373,9 @@ private: if (!__wrapped_) return false; -# ifndef _LIBCPP_HAS_NO_THREADS +# ifndef _LIBCPP_HAS_NO_THREADS lock_guard<mutex> __lock = __wrapped_streambuf_mutex::__instance().__get_lock(__wrapped_); -# endif +# endif bool __result = true; if (this->pptr() != this->pbase()) { @@ -401,24 +407,24 @@ private: } _LIBCPP_HIDE_FROM_ABI void __inc_reference() { -# ifndef _LIBCPP_HAS_NO_THREADS +# ifndef _LIBCPP_HAS_NO_THREADS if (__wrapped_) __wrapped_streambuf_mutex::__instance().__inc_reference(__wrapped_); -# endif +# endif } _LIBCPP_HIDE_FROM_ABI void __dec_reference() noexcept { -# ifndef _LIBCPP_HAS_NO_THREADS +# ifndef _LIBCPP_HAS_NO_THREADS if (__wrapped_) __wrapped_streambuf_mutex::__instance().__dec_reference(__wrapped_); -# endif +# endif } }; using std::syncbuf; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS using std::wsyncbuf; -# endif +# endif // [syncstream.syncbuf.special], specialized algorithms template <class _CharT, class _Traits, class _Allocator> @@ -474,17 +480,17 @@ public: // TODO validate other unformatted output functions. typename basic_ostream<char_type, traits_type>::sentry __s(*this); if (__s) { -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -# endif +# endif if (__sb_.emit() == false) this->setstate(ios::badbit); -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -# endif +# endif } } @@ -499,14 +505,16 @@ private: }; using std::osyncstream; -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS using std::wosyncstream; -# endif +# endif -#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) +# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) + #endif // _LIBCPP_SYNCSTREAM diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index 68ce63bd014..25cb7ce6d72 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -88,25 +88,25 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #include <__config> -#ifdef _LIBCPP_HAS_NO_THREADS -# error "<thread> is not supported since libc++ has been configured without support for threads." -#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) -#include <__thread/formatter.h> -#include <__thread/jthread.h> -#include <__thread/support.h> -#include <__thread/this_thread.h> -#include <__thread/thread.h> -#include <version> +# include <__thread/formatter.h> +# include <__thread/jthread.h> +# include <__thread/support.h> +# include <__thread/this_thread.h> +# include <__thread/thread.h> +# include <version> // standard-mandated includes // [thread.syn] -#include <compare> +# include <compare> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif + +#endif // !defined(_LIBCPP_HAS_NO_THREADS) #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index 9caeaaf926a..ab90d2bf5e3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -132,7 +132,12 @@ tuple(allocator_arg_t, Alloc, pair<T1, T2>) -> tuple<T1, T2>; // since C++ template <class Alloc, class ...T> tuple(allocator_arg_t, Alloc, tuple<T...>) -> tuple<T...>; // since C++17 -inline constexpr unspecified ignore; +struct ignore-type { // exposition only // Since C++26 + constexpr const ignore-type& + operator=(const auto &) const noexcept + { return *this; } +}; +inline constexpr ignore-type ignore; template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14 template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14 @@ -206,15 +211,16 @@ template <class... Types> // clang-format on #include <__compare/common_comparison_category.h> +#include <__compare/ordering.h> #include <__compare/synth_three_way.h> #include <__config> -#include <__functional/invoke.h> #include <__fwd/array.h> #include <__fwd/pair.h> #include <__fwd/tuple.h> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> #include <__tuple/find_index.h> +#include <__tuple/ignore.h> #include <__tuple/make_tuple_types.h> #include <__tuple/sfinae_helpers.h> #include <__tuple/tuple_element.h> @@ -228,6 +234,8 @@ template <class... Types> #include <__type_traits/conjunction.h> #include <__type_traits/copy_cvref.h> #include <__type_traits/disjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> @@ -248,6 +256,7 @@ template <class... Types> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> #include <__type_traits/unwrap_ref.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <__utility/move.h> @@ -835,8 +844,8 @@ public: // [tuple.assign] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& - operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) - noexcept(_And<is_nothrow_copy_assignable<_Tp>...>::value) { + operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) noexcept( + _And<is_nothrow_copy_assignable<_Tp>...>::value) { std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -859,8 +868,8 @@ public: # endif // _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& - operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) - noexcept(_And<is_nothrow_move_assignable<_Tp>...>::value) { + operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) noexcept( + _And<is_nothrow_move_assignable<_Tp>...>::value) { std::__memberwise_forward_assign( *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; @@ -870,8 +879,8 @@ public: class... _Up, __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...> const& __tuple) - noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(tuple<_Up...> const& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -879,8 +888,8 @@ public: template <class... _Up, __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...>&& __tuple) - noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(tuple<_Up...>&& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { std::__memberwise_forward_assign( *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; @@ -944,16 +953,16 @@ public: template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2> const& __pair) - noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(pair<_Up1, _Up2> const& __pair) noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) { std::get<0>(*this) = __pair.first; std::get<1>(*this) = __pair.second; return *this; } template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2>&& __pair) - noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(pair<_Up1, _Up2>&& __pair) noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) { std::get<0>(*this) = std::forward<_Up1>(__pair.first); std::get<1>(*this) = std::forward<_Up2>(__pair.second); return *this; @@ -964,8 +973,8 @@ public: class _Up, size_t _Np, __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np> const& __array) - noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(array<_Up, _Np> const& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) { std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } @@ -975,8 +984,8 @@ public: size_t _Np, class = void, __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value, int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np>&& __array) - noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& + operator=(array<_Up, _Np>&& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) { std::__memberwise_forward_assign( *this, std::move(__array), @@ -986,8 +995,8 @@ public: } // [tuple.swap] - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple& __t) - noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void + swap(tuple& __t) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) { __base_.swap(__t.__base_); } @@ -1045,8 +1054,8 @@ tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>; # endif template <class... _Tp, __enable_if_t<__all<__is_swappable_v<_Tp>...>::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) - noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) { +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void +swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) { __t.swap(__u); } @@ -1120,22 +1129,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_T return tuple<_Tp&...>(__t...); } -template <class _Up> -struct __ignore_t { - template <class _Tp> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const __ignore_t& operator=(_Tp&&) const { - return *this; - } -}; - -# if _LIBCPP_STD_VER >= 17 -inline constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); -# else -namespace { -constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); -} // namespace -# endif - template <class... _Tp> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<typename __unwrap_ref_decay<_Tp>::type...> make_tuple(_Tp&&... __t) { diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index aee9fcf4137..26c85f2284e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -144,6 +144,7 @@ namespace std // Relationships between types: template <class T, class U> struct is_same; template <class Base, class Derived> struct is_base_of; + template <class Base, class Derived> struct is_virtual_base_of; // C++26 template <class From, class To> struct is_convertible; template <typename From, typename To> struct is_nothrow_convertible; // C++20 @@ -391,6 +392,8 @@ namespace std = is_same<T, U>::value; // C++17 template <class Base, class Derived> inline constexpr bool is_base_of_v = is_base_of<Base, Derived>::value; // C++17 + template <class Base, class Derived> inline constexpr bool is_virtual_base_of_v + = is_virtual_base_of<Base, Derived>::value; // C++26 template <class From, class To> inline constexpr bool is_convertible_v = is_convertible<From, To>::value; // C++17 template <class Fn, class... ArgTypes> inline constexpr bool is_invocable_v @@ -418,7 +421,6 @@ namespace std */ #include <__config> -#include <__fwd/functional.h> // This is https://llvm.org/PR56938 #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_lvalue_reference.h> @@ -428,99 +430,92 @@ namespace std #include <__type_traits/aligned_storage.h> #include <__type_traits/aligned_union.h> #include <__type_traits/alignment_of.h> -#include <__type_traits/can_extract_key.h> -#include <__type_traits/common_reference.h> #include <__type_traits/common_type.h> #include <__type_traits/conditional.h> -#include <__type_traits/conjunction.h> #include <__type_traits/decay.h> -#include <__type_traits/dependent_type.h> -#include <__type_traits/disjunction.h> #include <__type_traits/enable_if.h> #include <__type_traits/extent.h> -#include <__type_traits/has_unique_object_representation.h> #include <__type_traits/has_virtual_destructor.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/invoke.h> #include <__type_traits/is_abstract.h> -#include <__type_traits/is_aggregate.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_array.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_base_of.h> -#include <__type_traits/is_bounded_array.h> -#include <__type_traits/is_callable.h> -#include <__type_traits/is_char_like_type.h> #include <__type_traits/is_class.h> #include <__type_traits/is_compound.h> #include <__type_traits/is_const.h> -#include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> #include <__type_traits/is_destructible.h> #include <__type_traits/is_empty.h> #include <__type_traits/is_enum.h> -#include <__type_traits/is_final.h> #include <__type_traits/is_floating_point.h> #include <__type_traits/is_function.h> #include <__type_traits/is_fundamental.h> -#include <__type_traits/is_implicitly_default_constructible.h> #include <__type_traits/is_integral.h> #include <__type_traits/is_literal_type.h> -#include <__type_traits/is_member_function_pointer.h> -#include <__type_traits/is_member_object_pointer.h> #include <__type_traits/is_member_pointer.h> #include <__type_traits/is_nothrow_assignable.h> #include <__type_traits/is_nothrow_constructible.h> -#include <__type_traits/is_nothrow_convertible.h> #include <__type_traits/is_nothrow_destructible.h> -#include <__type_traits/is_null_pointer.h> #include <__type_traits/is_object.h> #include <__type_traits/is_pod.h> #include <__type_traits/is_pointer.h> #include <__type_traits/is_polymorphic.h> #include <__type_traits/is_reference.h> -#include <__type_traits/is_reference_wrapper.h> -#include <__type_traits/is_referenceable.h> #include <__type_traits/is_same.h> #include <__type_traits/is_scalar.h> -#include <__type_traits/is_scoped_enum.h> #include <__type_traits/is_signed.h> -#include <__type_traits/is_specialization.h> #include <__type_traits/is_standard_layout.h> -#include <__type_traits/is_swappable.h> #include <__type_traits/is_trivial.h> #include <__type_traits/is_trivially_assignable.h> #include <__type_traits/is_trivially_constructible.h> #include <__type_traits/is_trivially_copyable.h> #include <__type_traits/is_trivially_destructible.h> -#include <__type_traits/is_unbounded_array.h> #include <__type_traits/is_union.h> #include <__type_traits/is_unsigned.h> #include <__type_traits/is_void.h> #include <__type_traits/is_volatile.h> -#include <__type_traits/make_const_lvalue_ref.h> #include <__type_traits/make_signed.h> #include <__type_traits/make_unsigned.h> -#include <__type_traits/maybe_const.h> -#include <__type_traits/negation.h> #include <__type_traits/rank.h> #include <__type_traits/remove_all_extents.h> #include <__type_traits/remove_const.h> -#include <__type_traits/remove_const_ref.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_extent.h> #include <__type_traits/remove_pointer.h> #include <__type_traits/remove_reference.h> #include <__type_traits/remove_volatile.h> #include <__type_traits/result_of.h> -#include <__type_traits/type_identity.h> #include <__type_traits/underlying_type.h> -#include <__type_traits/unwrap_ref.h> -#include <__type_traits/void_t.h> -#include <__utility/declval.h> -#include <cstddef> -#include <cstdint> + +#if _LIBCPP_STD_VER >= 14 +# include <__type_traits/is_final.h> +# include <__type_traits/is_null_pointer.h> +#endif + +#if _LIBCPP_STD_VER >= 17 +# include <__type_traits/conjunction.h> +# include <__type_traits/disjunction.h> +# include <__type_traits/has_unique_object_representation.h> +# include <__type_traits/invoke.h> +# include <__type_traits/is_aggregate.h> +# include <__type_traits/is_swappable.h> +# include <__type_traits/negation.h> +# include <__type_traits/void_t.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__type_traits/common_reference.h> +# include <__type_traits/is_bounded_array.h> +# include <__type_traits/is_constant_evaluated.h> +# include <__type_traits/is_nothrow_convertible.h> +# include <__type_traits/is_unbounded_array.h> +# include <__type_traits/type_identity.h> +# include <__type_traits/unwrap_ref.h> +#endif + #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/typeinfo b/contrib/libs/cxxsupp/libcxx/include/typeinfo index 266ae9550e1..3808966b119 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeinfo +++ b/contrib/libs/cxxsupp/libcxx/include/typeinfo @@ -58,6 +58,7 @@ public: #include <__config> #include <__exception/exception.h> +#include <__type_traits/integral_constant.h> #include <__type_traits/is_constant_evaluated.h> #include <__verbose_abort> #include <cstddef> @@ -281,13 +282,14 @@ struct __type_info_implementations { __impl; }; -# if defined(__arm64__) && __has_cpp_attribute(clang::ptrauth_vtable_pointer) -# if __has_feature(ptrauth_type_info_discriminated_vtable_pointer) +# if __has_cpp_attribute(_Clang::__ptrauth_vtable_pointer__) +# if __has_feature(ptrauth_type_info_vtable_pointer_discrimination) # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH \ - [[clang::ptrauth_vtable_pointer(process_independent, address_discrimination, type_discrimination)]] + [[_Clang::__ptrauth_vtable_pointer__(process_independent, address_discrimination, type_discrimination)]] # else # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH \ - [[clang::ptrauth_vtable_pointer(process_independent, no_address_discrimination, no_extra_discrimination)]] + [[_Clang::__ptrauth_vtable_pointer__( \ + process_independent, no_address_discrimination, no_extra_discrimination)]] # endif # else # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH @@ -393,7 +395,7 @@ private: #endif // defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() { +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_cast(); #else diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 7c31c4fce26..0d71a51ee9e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -586,6 +586,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__algorithm/is_permutation.h> #include <__assert> #include <__config> +#include <__functional/hash.h> #include <__functional/is_transparent.h> #include <__functional/operations.h> #include <__hash_table> @@ -595,14 +596,22 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__iterator/ranges_iterator_traits.h> #include <__memory/addressof.h> #include <__memory/allocator.h> +#include <__memory/allocator_traits.h> +#include <__memory/pointer_traits.h> +#include <__memory/unique_ptr.h> #include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> #include <__ranges/concepts.h> #include <__ranges/container_compatible_range.h> #include <__ranges/from_range.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/remove_const.h> #include <__type_traits/type_identity.h> #include <__utility/forward.h> +#include <__utility/pair.h> +#include <new> // launder #include <stdexcept> #include <tuple> #include <version> @@ -1202,7 +1211,7 @@ public: return allocator_type(__table_.__node_alloc()); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); } @@ -2001,7 +2010,7 @@ public: return allocator_type(__table_.__node_alloc()); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); } @@ -2532,6 +2541,7 @@ _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <bit> +# include <cmath> # include <concepts> # include <cstdlib> # include <iterator> diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 3297294a893..2b09c72b866 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -534,6 +534,7 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__algorithm/is_permutation.h> #include <__assert> #include <__config> +#include <__functional/hash.h> #include <__functional/is_transparent.h> #include <__functional/operations.h> #include <__hash_table> @@ -543,13 +544,23 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__iterator/ranges_iterator_traits.h> #include <__memory/addressof.h> #include <__memory/allocator.h> +#include <__memory/allocator_traits.h> #include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> #include <__ranges/concepts.h> #include <__ranges/container_compatible_range.h> #include <__ranges/from_range.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> +#include <__utility/move.h> +#include <__utility/pair.h> #include <version> // standard-mandated includes @@ -731,7 +742,7 @@ public: return allocator_type(__table_.__node_alloc()); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); } @@ -1325,7 +1336,7 @@ public: return allocator_type(__table_.__node_alloc()); } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __table_.size() == 0; } _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __table_.size(); } _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __table_.max_size(); } @@ -1800,6 +1811,7 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cmath> # include <concepts> # include <cstdlib> # include <functional> diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 90713da621c..f97907fbf72 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -247,25 +247,35 @@ template <class T> */ #include <__config> -#include <__utility/as_const.h> -#include <__utility/as_lvalue.h> -#include <__utility/auto_cast.h> -#include <__utility/cmp.h> + #include <__utility/declval.h> -#include <__utility/exception_guard.h> -#include <__utility/exchange.h> #include <__utility/forward.h> -#include <__utility/forward_like.h> -#include <__utility/in_place.h> -#include <__utility/integer_sequence.h> #include <__utility/move.h> #include <__utility/pair.h> #include <__utility/piecewise_construct.h> -#include <__utility/priority_tag.h> #include <__utility/rel_ops.h> #include <__utility/swap.h> -#include <__utility/to_underlying.h> -#include <__utility/unreachable.h> + +#if _LIBCPP_STD_VER >= 14 +# include <__utility/exchange.h> +# include <__utility/integer_sequence.h> +#endif + +#if _LIBCPP_STD_VER >= 17 +# include <__utility/as_const.h> +# include <__utility/in_place.h> +#endif + +#if _LIBCPP_STD_VER >= 20 +# include <__utility/cmp.h> +#endif + +#if _LIBCPP_STD_VER >= 23 +# include <__utility/forward_like.h> +# include <__utility/to_underlying.h> +# include <__utility/unreachable.h> +#endif + #include <version> // standard-mandated includes @@ -274,6 +284,10 @@ template <class T> #include <compare> #include <initializer_list> +// [tuple.creation] + +#include <__tuple/ignore.h> + // [tuple.helper] #include <__tuple/tuple_element.h> #include <__tuple/tuple_size.h> @@ -283,6 +297,10 @@ template <class T> #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <limits> +#endif + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cstdlib> # include <iosfwd> # include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index 5f2d03b7227..fd3aebaea0e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -214,13 +214,14 @@ namespace std { #include <__compare/common_comparison_category.h> #include <__compare/compare_three_way_result.h> +#include <__compare/ordering.h> #include <__compare/three_way_comparable.h> #include <__config> #include <__exception/exception.h> #include <__functional/hash.h> -#include <__functional/invoke.h> #include <__functional/operations.h> #include <__functional/unary_function.h> +#include <__fwd/variant.h> #include <__memory/addressof.h> #include <__memory/construct_at.h> #include <__tuple/find_index.h> @@ -230,14 +231,21 @@ namespace std { #include <__type_traits/add_pointer.h> #include <__type_traits/add_volatile.h> #include <__type_traits/common_type.h> +#include <__type_traits/conditional.h> #include <__type_traits/conjunction.h> +#include <__type_traits/decay.h> #include <__type_traits/dependent_type.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> #include <__type_traits/is_array.h> +#include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> +#include <__type_traits/is_convertible.h> #include <__type_traits/is_destructible.h> #include <__type_traits/is_nothrow_assignable.h> #include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/is_reference.h> +#include <__type_traits/is_swappable.h> #include <__type_traits/is_trivially_assignable.h> #include <__type_traits/is_trivially_constructible.h> #include <__type_traits/is_trivially_destructible.h> @@ -245,6 +253,7 @@ namespace std { #include <__type_traits/is_void.h> #include <__type_traits/remove_const.h> #include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> #include <__type_traits/type_identity.h> #include <__type_traits/void_t.h> #include <__utility/declval.h> @@ -296,7 +305,7 @@ struct __farray { _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; } }; -_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void +[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void __throw_bad_variant_access() { # ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_variant_access(); @@ -305,15 +314,7 @@ __throw_bad_variant_access() { # endif } -template <class... _Types> -class _LIBCPP_TEMPLATE_VIS variant; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS variant_size; - -template <class _Tp> -inline constexpr size_t variant_size_v = variant_size<_Tp>::value; - +// variant_size template <class _Tp> struct _LIBCPP_TEMPLATE_VIS variant_size<const _Tp> : variant_size<_Tp> {}; @@ -326,12 +327,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp> : variant_size<_Tp> template <class... _Types> struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>> : integral_constant<size_t, sizeof...(_Types)> {}; -template <size_t _Ip, class _Tp> -struct _LIBCPP_TEMPLATE_VIS variant_alternative; - -template <size_t _Ip, class _Tp> -using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type; - +// variant_alternative template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp> : add_const<variant_alternative_t<_Ip, _Tp>> {}; @@ -347,8 +343,6 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { using type = __type_pack_element<_Ip, _Types...>; }; -inline constexpr size_t variant_npos = static_cast<size_t>(-1); - template <size_t _NumAlternatives> _LIBCPP_HIDE_FROM_ABI constexpr auto __choose_index_type() { # ifdef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION @@ -368,9 +362,6 @@ template <class _IndexType> constexpr _IndexType __variant_npos = static_cast<_IndexType>(-1); template <class... _Types> -class _LIBCPP_TEMPLATE_VIS variant; - -template <class... _Types> _LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>& __as_variant(variant<_Types...>& __vs) noexcept { return __vs; } diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 2f714f1ec8c..fd58458edb2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -170,7 +170,7 @@ public: vector() noexcept(is_nothrow_default_constructible<allocator_type>::value); - explicit vector(const allocator_type&); + explicit vector(const allocator_type&) noexcept; explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14 vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); template <class InputIterator> @@ -178,8 +178,7 @@ public: template<container-compatible-range<bool> R> constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator()); vector(const vector& x); - vector(vector&& x) - noexcept(is_nothrow_move_constructible<allocator_type>::value); + vector(vector&& x) noexcept; vector(initializer_list<value_type> il); vector(initializer_list<value_type> il, const allocator_type& a); ~vector(); @@ -311,6 +310,10 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ #include <__algorithm/iterator_operations.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/lexicographical_compare_three_way.h> +#include <__algorithm/max.h> +#include <__algorithm/min.h> +#include <__algorithm/move.h> +#include <__algorithm/move_backward.h> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> #include <__algorithm/rotate.h> @@ -327,13 +330,20 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ #include <__functional/unary_function.h> #include <__fwd/vector.h> #include <__iterator/advance.h> +#include <__iterator/bounded_iter.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__iterator/move_iterator.h> +#include <__iterator/next.h> #include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> #include <__memory/addressof.h> #include <__memory/allocate_at_least.h> +#include <__memory/allocator.h> #include <__memory/allocator_traits.h> +#include <__memory/compressed_pair.h> +#include <__memory/construct_at.h> +#include <__memory/noexcept_move_assign_container.h> #include <__memory/pointer_traits.h> #include <__memory/swap_allocator.h> #include <__memory/temp_value.h> @@ -345,11 +355,15 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++ #include <__ranges/from_range.h> #include <__ranges/size.h> #include <__split_buffer> +#include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_allocator.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_same.h> #include <__type_traits/is_trivially_destructible.h> -#include <__type_traits/noexcept_move_assign_container.h> +#include <__type_traits/is_trivially_relocatable.h> #include <__type_traits/type_identity.h> #include <__utility/exception_guard.h> #include <__utility/forward.h> @@ -401,11 +415,16 @@ public: typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; -#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 1 +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 typedef pointer iterator; typedef const_pointer const_iterator; +#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR) + // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's + // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is + // considered contiguous. + typedef __bounded_iter<__wrap_iter<pointer> > iterator; + typedef __bounded_iter<__wrap_iter<const_pointer> > const_iterator; #else - // TODO: Implement iterator bounds checking without requiring the global database. typedef __wrap_iter<pointer> iterator; typedef __wrap_iter<const_pointer> const_iterator; #endif @@ -431,9 +450,9 @@ public: #if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) #else - _NOEXCEPT + noexcept #endif - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) { @@ -447,7 +466,7 @@ public: #if _LIBCPP_STD_VER >= 14 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { auto __guard = std::__make_exception_guard(__destroy_vector(*this)); if (__n > 0) { __vallocate(__n); @@ -469,7 +488,7 @@ public: template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x, const allocator_type& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); @@ -507,7 +526,7 @@ public: template <_ContainerCompatibleRange<_Tp> _Range> _LIBCPP_HIDE_FROM_ABI constexpr vector( from_range_t, _Range&& __range, const allocator_type& __alloc = allocator_type()) - : __end_cap_(nullptr, __alloc) { + : __alloc_(__alloc) { if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { auto __n = static_cast<size_type>(ranges::distance(__range)); __init_with_size(ranges::begin(__range), ranges::end(__range), __n); @@ -635,7 +654,7 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT { return static_cast<size_type>(__end_cap() - this->__begin_); } - _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return this->__begin_ == this->__end_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT; @@ -773,8 +792,7 @@ public: private: pointer __begin_ = nullptr; pointer __end_ = nullptr; - __compressed_pair<pointer, allocator_type> __end_cap_ = - __compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag()); + _LIBCPP_COMPRESSED_PAIR(pointer, __cap_ = nullptr, allocator_type, __alloc_); // Allocate space for __n objects // throws length_error if __n > max_size() @@ -843,8 +861,46 @@ private: void __append_uninitialized(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT; - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT { + +// We need to save the make_iter function and replace all constructor calls with it +// Made to support pointer iterators +#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 0 + return iterator(this, __p); +#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR) + // Bound the iterator according to the capacity, rather than the size. + // + // Vector guarantees that iterators stay valid as long as no reallocation occurs even if new elements are inserted + // into the container; for these cases, we need to make sure that the newly-inserted elements can be accessed + // through the bounded iterator without failing checks. The downside is that the bounded iterator won't catch + // access that is logically out-of-bounds, i.e., goes beyond the size, but is still within the capacity. With the + // current implementation, there is no connection between a bounded iterator and its associated container, so we + // don't have a way to update existing valid iterators when the container is resized and thus have to go with + // a laxer approach. + return std::__make_bounded_iter( + std::__wrap_iter<pointer>(__p), + std::__wrap_iter<pointer>(this->__begin_), + std::__wrap_iter<pointer>(this->__end_cap())); +#else + return iterator(__p); +#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { +#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 0 + return const_iterator(this, __p); +#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR) + // Bound the iterator according to the capacity, rather than the size. + return std::__make_bounded_iter( + std::__wrap_iter<const_pointer>(__p), + std::__wrap_iter<const_pointer>(this->__begin_), + std::__wrap_iter<const_pointer>(this->__end_cap())); +#else + return const_iterator(__p); +#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR + } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer @@ -939,17 +995,14 @@ private: ++__tx.__pos_; } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { - return this->__end_cap_.second(); - } + // TODO: Remove these now redundant accessors + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return this->__alloc_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { - return this->__end_cap_.second(); - } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT { - return this->__end_cap_.first(); + return this->__alloc_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT { return this->__cap_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT { - return this->__end_cap_.first(); + return this->__cap_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __clear() _NOEXCEPT { @@ -973,9 +1026,9 @@ private: __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); } - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); } + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); } - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); } + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) { if (__alloc() != __c.__alloc()) { @@ -1196,7 +1249,7 @@ template <class _InputIterator, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { __init_with_sentinel(__first, __last); } @@ -1217,21 +1270,21 @@ template <class _ForwardIterator, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { size_type __n = static_cast<size_type>(std::distance(__first, __last)); __init_with_size(__first, __last, __n); } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(const vector& __x) - : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) { + : __alloc_(__alloc_traits::select_on_container_copy_construction(__x.__alloc())) { __init_with_size(__x.__begin_, __x.__end_, __x.size()); } template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<allocator_type>& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { __init_with_size(__x.__begin_, __x.__end_, __x.size()); } @@ -1242,7 +1295,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) #endif - : __end_cap_(nullptr, std::move(__x.__alloc())) { + : __alloc_(std::move(__x.__alloc())) { this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); @@ -1252,7 +1305,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { if (__a == __x.__alloc()) { this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; @@ -1282,7 +1335,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) { template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) - : __end_cap_(nullptr, __a) { + : __alloc_(__a) { auto __guard = std::__make_exception_guard(__destroy_vector(*this)); if (__il.size() > 0) { __vallocate(__il.size()); @@ -1380,28 +1433,6 @@ vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel } } -// We need to save the make_iter function and replace all constructor calls with it -// Made to support pointer iterators -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator -vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { -#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 - return iterator(__p); -#else - return iterator(this, __p); -#endif -} - -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::const_iterator -vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { -#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 - return const_iterator(__p); -#else - return const_iterator(this, __p); -#endif -} - template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) { if (__n <= capacity()) { @@ -1490,7 +1521,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE #endif // _LIBCPP_HAS_NO_EXCEPTIONS allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(size(), size(), __a); - __swap_out_circular_buffer(__v); + // The Standard mandates shrink_to_fit() does not increase the capacity. + // With equal capacity keep the existing buffer. This avoids extra work + // due to swapping the elements. + if (__v.capacity() < capacity()) + __swap_out_circular_buffer(__v); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } @@ -1849,8 +1884,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x) std::swap(this->__begin_, __x.__begin_); std::swap(this->__end_, __x.__end_); std::swap(this->__end_cap(), __x.__end_cap()); - std::__swap_allocator( - this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>()); + std::__swap_allocator(this->__alloc(), __x.__alloc()); } template <class _Tp, class _Allocator> @@ -1908,7 +1942,7 @@ private: __storage_pointer __begin_; size_type __size_; - __compressed_pair<size_type, __storage_allocator> __cap_alloc_; + _LIBCPP_COMPRESSED_PAIR(size_type, __cap_, __storage_allocator, __alloc_); public: typedef __bit_reference<vector> reference; @@ -1919,15 +1953,12 @@ public: #endif private: - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type& __cap() _NOEXCEPT { return __cap_alloc_.first(); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const size_type& __cap() const _NOEXCEPT { - return __cap_alloc_.first(); - } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __storage_allocator& __alloc() _NOEXCEPT { - return __cap_alloc_.second(); - } + // TODO: Remove these now redundant accessors + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type& __cap() _NOEXCEPT { return __cap_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const size_type& __cap() const _NOEXCEPT { return __cap_; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __storage_allocator& __alloc() _NOEXCEPT { return __alloc_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const __storage_allocator& __alloc() const _NOEXCEPT { - return __cap_alloc_.second(); + return __alloc_; } static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); @@ -1990,7 +2021,7 @@ public: #if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<bool> _Range> _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type()) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) { auto __n = static_cast<size_type>(ranges::distance(__range)); __init_with_size(ranges::begin(__range), ranges::end(__range), __n); @@ -2063,7 +2094,7 @@ public: return __internal_cap_to_external(__cap()); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT { return __size_; } - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT { + [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool empty() const _NOEXCEPT { return __size_ == 0; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __n); @@ -2195,9 +2226,9 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const; private: - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); } + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_length_error() const { std::__throw_length_error("vector"); } - _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); } + [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("vector"); } template <class _InputIterator, class _Sentinel> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void @@ -2397,7 +2428,7 @@ vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel _ template <class _Allocator> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) {} + : __begin_(nullptr), __size_(0), __cap_(0) {} template <class _Allocator> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const allocator_type& __a) @@ -2406,12 +2437,12 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat #else _NOEXCEPT #endif - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { } template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) { + : __begin_(nullptr), __size_(0), __cap_(0) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, false); @@ -2421,7 +2452,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n) #if _LIBCPP_STD_VER >= 14 template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, false); @@ -2431,7 +2462,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) { + : __begin_(nullptr), __size_(0), __cap_(0) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); @@ -2441,7 +2472,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); @@ -2451,7 +2482,7 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all template <class _Allocator> template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) { + : __begin_(nullptr), __size_(0), __cap_(0) { __init_with_sentinel(__first, __last); } @@ -2459,14 +2490,14 @@ template <class _Allocator> template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { __init_with_sentinel(__first, __last); } template <class _Allocator> template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) { + : __begin_(nullptr), __size_(0), __cap_(0) { auto __n = static_cast<size_type>(std::distance(__first, __last)); __init_with_size(__first, __last, __n); } @@ -2475,7 +2506,7 @@ template <class _Allocator> template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { auto __n = static_cast<size_type>(std::distance(__first, __last)); __init_with_size(__first, __last, __n); } @@ -2484,7 +2515,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(initializer_list<value_type> __il) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __default_init_tag()) { + : __begin_(nullptr), __size_(0), __cap_(0) { size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { __vallocate(__n); @@ -2495,7 +2526,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(initializer_list< template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) { size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { __vallocate(__n); @@ -2509,7 +2540,8 @@ template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v) : __begin_(nullptr), __size_(0), - __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc())) { + __cap_(0), + __alloc_(__storage_traits::select_on_container_copy_construction(__v.__alloc())) { if (__v.size() > 0) { __vallocate(__v.size()); __construct_at_end(__v.begin(), __v.end(), __v.size()); @@ -2518,7 +2550,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) { if (__v.size() > 0) { __vallocate(__v.size()); __construct_at_end(__v.begin(), __v.end(), __v.size()); @@ -2550,7 +2582,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat #endif : __begin_(__v.__begin_), __size_(__v.__size_), - __cap_alloc_(std::move(__v.__cap_alloc_)) { + __cap_(__v.__cap_), + __alloc_(std::move(__v.__alloc_)) { __v.__begin_ = nullptr; __v.__size_ = 0; __v.__cap() = 0; @@ -2559,7 +2592,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a) - : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) { + : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) { if (__a == allocator_type(__v.__alloc())) { this->__begin_ = __v.__begin_; this->__size_ = __v.__size_; @@ -2851,8 +2884,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x) std::swap(this->__begin_, __x.__begin_); std::swap(this->__size_, __x.__size_); std::swap(this->__cap(), __x.__cap()); - std::__swap_allocator( - this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>()); + std::__swap_allocator(this->__alloc(), __x.__alloc()); } template <class _Allocator> @@ -2995,8 +3027,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const vector<_Tp, _Allocator>& __x, template <class _Tp, class _Allocator> _LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp> operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index 460af8b6d39..5d679caac0b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -101,7 +101,7 @@ __cpp_lib_execution 201902L <execution> 201603L // C++17 __cpp_lib_expected 202211L <expected> __cpp_lib_filesystem 201703L <filesystem> -__cpp_lib_format 202106L <format> +__cpp_lib_format 202110L <format> __cpp_lib_format_path 202403L <filesystem> __cpp_lib_format_ranges 202207L <format> __cpp_lib_format_uchar 202311L <format> @@ -159,7 +159,8 @@ __cpp_lib_make_unique 201304L <memory> __cpp_lib_map_try_emplace 201411L <map> __cpp_lib_math_constants 201907L <numbers> __cpp_lib_math_special_functions 201603L <cmath> -__cpp_lib_mdspan 202207L <mdspan> +__cpp_lib_mdspan 202406L <mdspan> + 202207L // C++23 __cpp_lib_memory_resource 201603L <memory_resource> __cpp_lib_move_iterator_concept 202207L <iterator> __cpp_lib_move_only_function 202110L <functional> @@ -181,14 +182,16 @@ __cpp_lib_philox_engine 202406L <random> __cpp_lib_polymorphic_allocator 201902L <memory_resource> __cpp_lib_print 202207L <ostream> <print> __cpp_lib_quoted_string_io 201304L <iomanip> -__cpp_lib_ranges 202207L <algorithm> <functional> <iterator> +__cpp_lib_ranges 202406L <algorithm> <functional> <iterator> <memory> <ranges> + 202110L // C++20 __cpp_lib_ranges_as_const 202207L <ranges> __cpp_lib_ranges_as_rvalue 202207L <ranges> __cpp_lib_ranges_chunk 202202L <ranges> __cpp_lib_ranges_chunk_by 202202L <ranges> __cpp_lib_ranges_concat 202403L <ranges> __cpp_lib_ranges_contains 202207L <algorithm> +__cpp_lib_ranges_find_last 202207L <algorithm> __cpp_lib_ranges_iota 202202L <numeric> __cpp_lib_ranges_join_with 202202L <ranges> __cpp_lib_ranges_repeat 202207L <ranges> @@ -230,12 +233,13 @@ __cpp_lib_stdatomic_h 202011L <stdatomic.h> __cpp_lib_string_contains 202011L <string> <string_view> __cpp_lib_string_resize_and_overwrite 202110L <string> __cpp_lib_string_udls 201304L <string> -__cpp_lib_string_view 201803L <string> <string_view> +__cpp_lib_string_view 202403L <string> <string_view> + 201803L // C++20 201606L // C++17 __cpp_lib_submdspan 202306L <mdspan> __cpp_lib_syncbuf 201803L <syncstream> __cpp_lib_text_encoding 202306L <text_encoding> -__cpp_lib_three_way_comparison 201711L <compare> +__cpp_lib_three_way_comparison 201907L <compare> __cpp_lib_to_address 201711L <memory> __cpp_lib_to_array 201907L <array> __cpp_lib_to_chars 202306L <charconv> @@ -366,7 +370,7 @@ __cpp_lib_void_t 201411L <type_traits> # define __cpp_lib_atomic_flag_test 201907L // # define __cpp_lib_atomic_float 201711L # define __cpp_lib_atomic_lock_free_type_aliases 201907L -// # define __cpp_lib_atomic_ref 201806L +# define __cpp_lib_atomic_ref 201806L // # define __cpp_lib_atomic_shared_ptr 201711L # define __cpp_lib_atomic_value_initialization 201911L # if _LIBCPP_AVAILABILITY_HAS_SYNC @@ -403,7 +407,7 @@ __cpp_lib_void_t 201411L <type_traits> # define __cpp_lib_erase_if 202002L # undef __cpp_lib_execution // # define __cpp_lib_execution 201902L -// # define __cpp_lib_format 202106L +# define __cpp_lib_format 202110L # define __cpp_lib_format_uchar 202311L # define __cpp_lib_generic_unordered_lookup 201811L # define __cpp_lib_int_pow2 202002L @@ -413,7 +417,7 @@ __cpp_lib_void_t 201411L <type_traits> // # define __cpp_lib_is_layout_compatible 201907L # define __cpp_lib_is_nothrow_convertible 201806L // # define __cpp_lib_is_pointer_interconvertible 201907L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && _LIBCPP_AVAILABILITY_HAS_SYNC +# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC # define __cpp_lib_jthread 201911L # endif # if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC @@ -425,7 +429,7 @@ __cpp_lib_void_t 201411L <type_traits> # if _LIBCPP_AVAILABILITY_HAS_PMR # define __cpp_lib_polymorphic_allocator 201902L # endif -# define __cpp_lib_ranges 202207L +# define __cpp_lib_ranges 202110L # define __cpp_lib_remove_cvref 201711L # if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC # define __cpp_lib_semaphore 201907L @@ -443,7 +447,7 @@ __cpp_lib_void_t 201411L <type_traits> # if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) # define __cpp_lib_syncbuf 201803L # endif -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L # define __cpp_lib_to_address 201711L # define __cpp_lib_to_array 201907L # define __cpp_lib_type_identity 201806L @@ -475,13 +479,16 @@ __cpp_lib_void_t 201411L <type_traits> // # define __cpp_lib_move_only_function 202110L # undef __cpp_lib_optional # define __cpp_lib_optional 202110L -// # define __cpp_lib_out_ptr 202106L +# define __cpp_lib_out_ptr 202106L # define __cpp_lib_print 202207L +# undef __cpp_lib_ranges +# define __cpp_lib_ranges 202406L // # define __cpp_lib_ranges_as_const 202207L # define __cpp_lib_ranges_as_rvalue 202207L // # define __cpp_lib_ranges_chunk 202202L # define __cpp_lib_ranges_chunk_by 202202L # define __cpp_lib_ranges_contains 202207L +# define __cpp_lib_ranges_find_last 202207L // # define __cpp_lib_ranges_iota 202202L // # define __cpp_lib_ranges_join_with 202202L # define __cpp_lib_ranges_repeat 202207L @@ -506,7 +513,9 @@ __cpp_lib_void_t 201411L <type_traits> # undef __cpp_lib_bind_front # define __cpp_lib_bind_front 202306L # define __cpp_lib_bitset 202306L -// # define __cpp_lib_constexpr_new 202406L +# if !defined(_LIBCPP_ABI_VCRUNTIME) +# define __cpp_lib_constexpr_new 202406L +# endif // # define __cpp_lib_constrained_equality 202403L // # define __cpp_lib_copyable_function 202306L // # define __cpp_lib_debugging 202311L @@ -527,12 +536,16 @@ __cpp_lib_void_t 201411L <type_traits> // # define __cpp_lib_generate_random 202403L // # define __cpp_lib_hazard_pointer 202306L // # define __cpp_lib_inplace_vector 202406L -// # define __cpp_lib_is_virtual_base_of 202406L +# if __has_builtin(__builtin_is_virtual_base_of) +# define __cpp_lib_is_virtual_base_of 202406L +# endif // # define __cpp_lib_is_within_lifetime 202306L // # define __cpp_lib_linalg 202311L +# undef __cpp_lib_mdspan +# define __cpp_lib_mdspan 202406L // # define __cpp_lib_optional_range_support 202406L # undef __cpp_lib_out_ptr -// # define __cpp_lib_out_ptr 202311L +# define __cpp_lib_out_ptr 202311L // # define __cpp_lib_philox_engine 202406L // # define __cpp_lib_ranges_concat 202403L # define __cpp_lib_ratio 202306L @@ -544,6 +557,8 @@ __cpp_lib_void_t 201411L <type_traits> # define __cpp_lib_span_at 202311L # define __cpp_lib_span_initializer_list 202311L # define __cpp_lib_sstream_from_string_view 202306L +# undef __cpp_lib_string_view +# define __cpp_lib_string_view 202403L // # define __cpp_lib_submdspan 202306L // # define __cpp_lib_text_encoding 202306L # undef __cpp_lib_to_chars diff --git a/contrib/libs/cxxsupp/libcxx/include/wchar.h b/contrib/libs/cxxsupp/libcxx/include/wchar.h index d4268c6d2c2..c965b28e57c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/wchar.h +++ b/contrib/libs/cxxsupp/libcxx/include/wchar.h @@ -108,11 +108,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, # include <__config> # include <stddef.h> -# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# error \ - "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled" -# endif - # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif @@ -142,7 +137,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, # endif # endif -# if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD) +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD) extern "C++" { inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) { return (wchar_t*)wcschr(__s, __c); @@ -197,15 +193,16 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wmemchr(wchar_t return __libcpp_wmemchr(__s, __c, __n); } } -# endif +# endif -# if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__)) +# if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__)) extern "C" { size_t mbsnrtowcs( wchar_t* __restrict __dst, const char** __restrict __src, size_t __nmc, size_t __len, mbstate_t* __restrict __ps); size_t wcsnrtombs( char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps); } // extern "C" -# endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__) +# endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__) +# endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS #endif // _LIBCPP_WCHAR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/wctype.h b/contrib/libs/cxxsupp/libcxx/include/wctype.h index c76ec5a3f06..9f378eaf820 100644 --- a/contrib/libs/cxxsupp/libcxx/include/wctype.h +++ b/contrib/libs/cxxsupp/libcxx/include/wctype.h @@ -46,11 +46,6 @@ wctrans_t wctrans(const char* property); #include <__config> -#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) -# error \ - "The <wctype.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled" -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif |