diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-02 19:27:12 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2023-11-02 20:14:23 +0300 |
commit | ea7266e3afdfe76274c756747fbd24626e1c205a (patch) | |
tree | 9b8370f3cf8d4399fc960a2c50aa9759f5acf554 | |
parent | a528d5d25d42706fe385120b27e1df3a257823fb (diff) | |
download | ydb-ea7266e3afdfe76274c756747fbd24626e1c205a.tar.gz |
Upd libc++ to 14 Jun 2022 1cf4113952ae3e4cc75decdf6feb3ce5dd8ca4a1
164 files changed, 4919 insertions, 3532 deletions
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml index e4b84de2ae..b276a247e7 100644 --- a/build/sysincl/stl-to-libcxx.yml +++ b/build/sysincl/stl-to-libcxx.yml @@ -176,7 +176,6 @@ - __locale: contrib/libs/cxxsupp/libcxx/include/__locale - __mbstate_t.h: contrib/libs/cxxsupp/libcxx/include/__mbstate_t.h - __mutex_base: contrib/libs/cxxsupp/libcxx/include/__mutex_base - - __string: contrib/libs/cxxsupp/libcxx/include/__string - __threading_support: contrib/libs/cxxsupp/libcxx/include/__threading_support - __tuple: contrib/libs/cxxsupp/libcxx/include/__tuple - __undef_macros: contrib/libs/cxxsupp/libcxx/include/__undef_macros @@ -223,6 +222,7 @@ - __algorithm/is_sorted.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted.h - __algorithm/is_sorted_until.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/is_sorted_until.h - __algorithm/iter_swap.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/iter_swap.h + - __algorithm/iterator_operations.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h - __algorithm/lexicographical_compare.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/lexicographical_compare.h - __algorithm/lower_bound.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h - __algorithm/make_heap.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h @@ -248,8 +248,10 @@ - __algorithm/pop_heap.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h - __algorithm/prev_permutation.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/prev_permutation.h - __algorithm/push_heap.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/push_heap.h + - __algorithm/ranges_adjacent_find.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h - __algorithm/ranges_all_of.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h - __algorithm/ranges_any_of.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h + - __algorithm/ranges_binary_search.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h - __algorithm/ranges_copy.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy.h - __algorithm/ranges_copy_backward.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_backward.h - __algorithm/ranges_copy_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_if.h @@ -260,6 +262,7 @@ - __algorithm/ranges_fill.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h - __algorithm/ranges_fill_n.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h - __algorithm/ranges_find.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find.h + - __algorithm/ranges_find_first_of.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h - __algorithm/ranges_find_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h - __algorithm/ranges_find_if_not.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h - __algorithm/ranges_for_each.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h @@ -267,6 +270,7 @@ - __algorithm/ranges_is_partitioned.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h - __algorithm/ranges_is_sorted.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h - __algorithm/ranges_is_sorted_until.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h + - __algorithm/ranges_lower_bound.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h - __algorithm/ranges_max.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max.h - __algorithm/ranges_max_element.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h - __algorithm/ranges_min.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_min.h @@ -275,9 +279,12 @@ - __algorithm/ranges_minmax_element.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax_element.h - __algorithm/ranges_mismatch.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_mismatch.h - __algorithm/ranges_none_of.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h + - __algorithm/ranges_replace.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h + - __algorithm/ranges_replace_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h - __algorithm/ranges_reverse.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h - __algorithm/ranges_swap_ranges.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_swap_ranges.h - __algorithm/ranges_transform.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_transform.h + - __algorithm/ranges_upper_bound.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h - __algorithm/remove.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h - __algorithm/remove_copy.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_copy.h - __algorithm/remove_copy_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/remove_copy_if.h @@ -313,6 +320,8 @@ - __algorithm/upper_bound.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h - __bit/bit_cast.h: contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h - __bit/byteswap.h: contrib/libs/cxxsupp/libcxx/include/__bit/byteswap.h + - __charconv/tables.h: contrib/libs/cxxsupp/libcxx/include/__charconv/tables.h + - __charconv/to_chars_base_10.h: contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h - __chrono/calendar.h: contrib/libs/cxxsupp/libcxx/include/__chrono/calendar.h - __chrono/convert_to_timespec.h: contrib/libs/cxxsupp/libcxx/include/__chrono/convert_to_timespec.h - __chrono/day.h: contrib/libs/cxxsupp/libcxx/include/__chrono/day.h @@ -468,6 +477,8 @@ - __ranges/enable_borrowed_range.h: contrib/libs/cxxsupp/libcxx/include/__ranges/enable_borrowed_range.h - __ranges/enable_view.h: contrib/libs/cxxsupp/libcxx/include/__ranges/enable_view.h - __ranges/size.h: contrib/libs/cxxsupp/libcxx/include/__ranges/size.h + - __string/char_traits.h: contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h + - __string/extern_template_lists.h: contrib/libs/cxxsupp/libcxx/include/__string/extern_template_lists.h - __support/android/locale_bionic.h: contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h - __support/fuchsia/xlocale.h: contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h - __support/ibm/locale_mgmt_zos.h: contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h @@ -490,14 +501,21 @@ - __type_traits/add_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h - __type_traits/add_rvalue_reference.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_rvalue_reference.h - __type_traits/add_volatile.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_volatile.h + - __type_traits/alignment_of.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h + - __type_traits/apply_cv.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/apply_cv.h - __type_traits/conditional.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h + - __type_traits/conjunction.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/conjunction.h - __type_traits/decay.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/decay.h + - __type_traits/disjunction.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/disjunction.h - __type_traits/enable_if.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/enable_if.h + - __type_traits/has_unique_object_representation.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/has_unique_object_representation.h + - __type_traits/has_virtual_destructor.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/has_virtual_destructor.h - __type_traits/extent.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h - __type_traits/integral_constant.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/integral_constant.h - __type_traits/is_abstract.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h - __type_traits/is_aggregate.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h - __type_traits/is_arithmetic.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_arithmetic.h + - __type_traits/is_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_assignable.h - __type_traits/is_array.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h - __type_traits/is_base_of.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_of.h - __type_traits/is_bounded_array.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h @@ -505,7 +523,14 @@ - __type_traits/is_class.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h - __type_traits/is_compound.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h - __type_traits/is_const.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_const.h + - __type_traits/is_constant_evaluated.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constant_evaluated.h + - __type_traits/is_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constructible.h - __type_traits/is_convertible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_convertible.h + - __type_traits/is_copy_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_assignable.h + - __type_traits/is_copy_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_constructible.h + - __type_traits/is_core_convertible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_core_convertible.h + - __type_traits/is_default_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_default_constructible.h + - __type_traits/is_destructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_destructible.h - __type_traits/is_empty.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.h - __type_traits/is_enum.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h - __type_traits/is_final.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.h @@ -513,23 +538,49 @@ - __type_traits/is_function.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h - __type_traits/is_fundamental.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h - __type_traits/is_integral.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h + - __type_traits/is_literal_type.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_literal_type.h - __type_traits/is_member_function_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h - __type_traits/is_member_object_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h - __type_traits/is_member_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h + - __type_traits/is_move_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_assignable.h + - __type_traits/is_move_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_constructible.h + - __type_traits/is_nothrow_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_assignable.h + - __type_traits/is_nothrow_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h + - __type_traits/is_nothrow_copy_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_assignable.h + - __type_traits/is_nothrow_copy_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_constructible.h + - __type_traits/is_nothrow_default_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_default_constructible.h + - __type_traits/is_nothrow_destructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h + - __type_traits/is_nothrow_move_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_assignable.h + - __type_traits/is_nothrow_move_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_constructible.h - __type_traits/is_null_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h - __type_traits/is_object.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h + - __type_traits/is_pod.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pod.h - __type_traits/is_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h - __type_traits/is_reference.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h + - __type_traits/is_polymorphic.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_polymorphic.h - __type_traits/is_reference_wrapper.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h - __type_traits/is_referenceable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.h - __type_traits/is_same.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_same.h - __type_traits/is_scalar.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h + - __type_traits/is_scoped_enum.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scoped_enum.h - __type_traits/is_signed.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_signed.h - __type_traits/is_unbounded_array.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h + - __type_traits/is_standard_layout.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_standard_layout.h + - __type_traits/is_trivial.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivial.h + - __type_traits/is_trivially_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_assignable.h + - __type_traits/is_trivially_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_constructible.h + - __type_traits/is_trivially_copy_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_assignable.h + - __type_traits/is_trivially_copy_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_constructible.h + - __type_traits/is_trivially_copyable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copyable.h + - __type_traits/is_trivially_default_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_default_constructible.h + - __type_traits/is_trivially_destructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_destructible.h + - __type_traits/is_trivially_move_assignable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_assignable.h + - __type_traits/is_trivially_move_constructible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_constructible.h - __type_traits/is_union.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.h - __type_traits/is_unsigned.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h - __type_traits/is_void.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h - __type_traits/is_volatile.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_volatile.h + - __type_traits/negation.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/negation.h - __type_traits/rank.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h - __type_traits/remove_all_extents.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h - __type_traits/remove_const.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_const.h @@ -539,6 +590,8 @@ - __type_traits/remove_reference.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_reference.h - __type_traits/remove_volatile.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_volatile.h - __type_traits/type_identity.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/type_identity.h + - __type_traits/underlying_type.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/underlying_type.h + - __type_traits/void_t.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/void_t.h - __utility/as_const.h: contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h - __utility/auto_cast.h: contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h - __utility/cmp.h: contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h @@ -557,3 +610,4 @@ - __utility/transaction.h: contrib/libs/cxxsupp/libcxx/include/__utility/transaction.h - __utility/unreachable.h: contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h - __variant/monostate.h: contrib/libs/cxxsupp/libcxx/include/__variant/monostate.h + diff --git a/build/ymake.core.conf b/build/ymake.core.conf index ae74503410..5fd87328e6 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -9,7 +9,7 @@ FAKEID=628318530716 SANDBOX_FAKEID=${FAKEID}.7600000 -CPP_FAKEID=2023-10-24 +CPP_FAKEID=2023-10-27 GO_FAKEID=11100371 ANDROID_FAKEID=2023-05-17 CLANG_TIDY_FAKEID=2023-06-06 diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h index 15a17e1cde..121a741d07 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/binary_search.h @@ -21,23 +21,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Compare, class _ForwardIterator, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -bool -__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) -{ - __first = _VSTD::__lower_bound<_Compare>(__first, __last, __value_, __comp); - return __first != __last && !__comp(__value_, *__first); -} - template <class _ForwardIterator, class _Tp, class _Compare> _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { - typedef typename __comp_ref_type<_Compare>::type _Comp_ref; - return _VSTD::__binary_search<_Comp_ref>(__first, __last, __value_, __comp); + using _Comp_ref = typename __comp_ref_type<_Compare>::type; + __first = std::lower_bound<_ForwardIterator, _Tp, _Comp_ref>(__first, __last, __value_, __comp); + return __first != __last && !__comp(__value_, *__first); } template <class _ForwardIterator, class _Tp> @@ -46,8 +38,8 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { - return _VSTD::binary_search(__first, __last, __value_, - __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); + return std::binary_search(__first, __last, __value_, + __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h index b893dbece0..c6f66c0e56 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/comp_ref_type.h @@ -68,7 +68,7 @@ template <class _Comp> struct __comp_ref_type { // Pass the comparator by lvalue reference. Or in debug mode, using a // debugging wrapper that stores a reference. -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE typedef __debug_less<_Comp> type; #else typedef _Comp& type; diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h index 00587ecb5b..2a4e535c6f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/copy.h @@ -56,25 +56,36 @@ pair<_InValueT*, _OutValueT*> __copy_impl(_InValueT* __first, _InValueT* __last, return std::make_pair(__first + __n, __result + __n); } -template <class _InValueT, - class _OutValueT, - class = __enable_if_t<is_same<typename remove_const<_InValueT>::type, _OutValueT>::value - && is_trivially_copy_assignable<_OutValueT>::value> > +template <class _InIter, class _OutIter, + __enable_if_t<is_same<typename remove_const<__iter_value_type<_InIter> >::type, __iter_value_type<_OutIter> >::value + && __is_cpp17_contiguous_iterator<_InIter>::value + && __is_cpp17_contiguous_iterator<_OutIter>::value + && is_trivially_copy_assignable<__iter_value_type<_OutIter> >::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 -pair<reverse_iterator<_InValueT*>, reverse_iterator<_OutValueT*> > -__copy_impl(reverse_iterator<_InValueT*> __first, - reverse_iterator<_InValueT*> __last, - reverse_iterator<_OutValueT*> __result) { - auto __first_base = __first.base(); - auto __last_base = __last.base(); - auto __result_base = __result.base(); +pair<reverse_iterator<_InIter>, reverse_iterator<_OutIter> > +__copy_impl(reverse_iterator<_InIter> __first, + reverse_iterator<_InIter> __last, + reverse_iterator<_OutIter> __result) { + auto __first_base = std::__unwrap_iter(__first.base()); + auto __last_base = std::__unwrap_iter(__last.base()); + auto __result_base = std::__unwrap_iter(__result.base()); auto __result_first = __result_base - (__first_base - __last_base); std::__copy_impl(__last_base, __first_base, __result_first); - return std::make_pair(__last, reverse_iterator<_OutValueT*>(__result_first)); + return std::make_pair(__last, reverse_iterator<_OutIter>(std::__rewrap_iter(__result.base(), __result_first))); } template <class _InIter, class _Sent, class _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 +pair<reverse_iterator<reverse_iterator<_InIter> >, reverse_iterator<reverse_iterator<_OutIter> > > +__copy_impl(reverse_iterator<reverse_iterator<_InIter> > __first, + reverse_iterator<reverse_iterator<_Sent> > __last, + reverse_iterator<reverse_iterator<_OutIter> > __result); + +template <class _InIter, class _Sent, class _OutIter, + __enable_if_t<!(is_copy_constructible<_InIter>::value + && is_copy_constructible<_Sent>::value + && is_copy_constructible<_OutIter>::value), int> = 0 > +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) { return std::__copy_impl(std::move(__first), std::move(__last), std::move(__result)); } @@ -82,13 +93,26 @@ pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) template <class _InIter, class _Sent, class _OutIter, __enable_if_t<is_copy_constructible<_InIter>::value && is_copy_constructible<_Sent>::value - && is_copy_constructible<_OutIter>::value> > + && is_copy_constructible<_OutIter>::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 -pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) { +pair<_InIter, _OutIter> +__copy(_InIter __first, _Sent __last, _OutIter __result) { auto __ret = std::__copy_impl(std::__unwrap_iter(__first), std::__unwrap_iter(__last), std::__unwrap_iter(__result)); return std::make_pair(std::__rewrap_iter(__first, __ret.first), std::__rewrap_iter(__result, __ret.second)); } +// __unwrap_iter can't unwrap random_access_iterators, so we need to unwrap two reverse_iterators manually +template <class _InIter, class _Sent, class _OutIter> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 +pair<reverse_iterator<reverse_iterator<_InIter> >, reverse_iterator<reverse_iterator<_OutIter> > > +__copy_impl(reverse_iterator<reverse_iterator<_InIter> > __first, + reverse_iterator<reverse_iterator<_Sent> > __last, + reverse_iterator<reverse_iterator<_OutIter> > __result) { + auto __ret = std::__copy(__first.base().base(), __last.base().base(), __result.base().base()); + return std::make_pair(reverse_iterator<reverse_iterator<_InIter> >(reverse_iterator<_InIter>(__ret.first)), + reverse_iterator<reverse_iterator<_OutIter> >(reverse_iterator<_OutIter>(__ret.second))); +} + template <class _InputIterator, class _OutputIterator> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h index 37a2c299f0..2a07364bb6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/equal_range.h @@ -12,10 +12,15 @@ #include <__algorithm/comp.h> #include <__algorithm/comp_ref_type.h> #include <__algorithm/half_positive.h> +#include <__algorithm/iterator_operations.h> #include <__algorithm/lower_bound.h> #include <__algorithm/upper_bound.h> #include <__config> -#include <iterator> +#include <__functional/identity.h> +#include <__iterator/advance.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__utility/pair.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -46,10 +51,11 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va } else { + auto __proj = std::__identity(); _ForwardIterator __mp1 = __m; return pair<_ForwardIterator, _ForwardIterator> ( - _VSTD::__lower_bound<_Compare>(__first, __m, __value_, __comp), + _VSTD::__lower_bound_impl<_StdIterOps>(__first, __m, __value_, __comp, __proj), _VSTD::__upper_bound<_Compare>(++__mp1, __last, __value_, __comp) ); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h index 90ca152c5b..ffc160cbe4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/inplace_merge.h @@ -17,7 +17,10 @@ #include <__algorithm/rotate.h> #include <__algorithm/upper_bound.h> #include <__config> +#include <__iterator/advance.h> +#include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__utility/swap.h> #include <memory> @@ -166,7 +169,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, __len11 = __len1 / 2; __m1 = __first; _VSTD::advance(__m1, __len11); - __m2 = _VSTD::__lower_bound<_Compare>(__middle, __last, *__m1, __comp); + __m2 = std::lower_bound(__middle, __last, *__m1, __comp); __len21 = _VSTD::distance(__middle, __m2); } difference_type __len12 = __len1 - __len11; // distance(__m1, __middle) diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h new file mode 100644 index 0000000000..c02f9bf649 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/iterator_operations.h @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// 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___ALGORIHTM_ITERATOR_OPERATIONS_H +#define _LIBCPP___ALGORIHTM_ITERATOR_OPERATIONS_H + +#include <__config> +#include <__iterator/advance.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +struct _RangesIterOps { + static constexpr auto advance = ranges::advance; + static constexpr auto distance = ranges::distance; +}; +#endif + +struct _StdIterOps { + + template <class _Iterator, class _Distance> + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 void advance(_Iterator& __iter, _Distance __count) { + return std::advance(__iter, __count); + } + + template <class _Iterator> + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 + typename iterator_traits<_Iterator>::difference_type distance(_Iterator __first, _Iterator __last) { + return std::distance(__first, __last); + } + +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ALGORIHTM_ITERATOR_OPERATIONS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h index 26b64ec12d..fbcd5c7e90 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/lower_bound.h @@ -11,8 +11,15 @@ #include <__algorithm/comp.h> #include <__algorithm/half_positive.h> +#include <__algorithm/iterator_operations.h> #include <__config> -#include <iterator> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__iterator/advance.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__type_traits/is_callable.h> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,45 +27,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Compare, class _ForwardIterator, class _Tp> -_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator -__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) -{ - typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; - difference_type __len = _VSTD::distance(__first, __last); - while (__len != 0) - { - difference_type __l2 = _VSTD::__half_positive(__len); - _ForwardIterator __m = __first; - _VSTD::advance(__m, __l2); - if (__comp(*__m, __value_)) - { - __first = ++__m; - __len -= __l2 + 1; - } - else - __len = __l2; +template <class _IterOps, class _Iter, class _Sent, class _Type, class _Proj, class _Comp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +_Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) { + auto __len = _IterOps::distance(__first, __last); + + while (__len != 0) { + auto __l2 = std::__half_positive(__len); + _Iter __m = __first; + _IterOps::advance(__m, __l2); + if (std::__invoke(__comp, std::__invoke(__proj, *__m), __value)) { + __first = ++__m; + __len -= __l2 + 1; + } else { + __len = __l2; } - return __first; + } + return __first; } template <class _ForwardIterator, class _Tp, class _Compare> -_LIBCPP_NODISCARD_EXT inline -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_ForwardIterator -lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) -{ - return _VSTD::__lower_bound<_Compare&>(__first, __last, __value_, __comp); +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +_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"); + auto __proj = std::__identity(); + return std::__lower_bound_impl<_StdIterOps>(__first, __last, __value_, __comp, __proj); } template <class _ForwardIterator, class _Tp> -_LIBCPP_NODISCARD_EXT inline -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_ForwardIterator -lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) -{ - return _VSTD::lower_bound(__first, __last, __value_, - __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 +_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { + return std::lower_bound(__first, __last, __value_, + __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h index 0f9f66d3ca..60b9280f75 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h @@ -13,6 +13,7 @@ #include <__algorithm/comp_ref_type.h> #include <__algorithm/sort.h> #include <__config> +#include <__debug> #include <__iterator/iterator_traits.h> #include <__utility/swap.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h index 8adf5b2f4f..3870c0cc93 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h @@ -15,6 +15,7 @@ #include <__algorithm/sift_down.h> #include <__algorithm/sort_heap.h> #include <__config> +#include <__debug> #include <__iterator/iterator_traits.h> #include <__utility/swap.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition_point.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition_point.h index c2fa841edc..1675534e60 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partition_point.h @@ -11,7 +11,9 @@ #include <__algorithm/half_positive.h> #include <__config> -#include <iterator> +#include <__iterator/advance.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h new file mode 100644 index 0000000000..e798d56829 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_adjacent_find.h @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H +#define _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H + +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __adjacent_find { +struct __fn { + + 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) { + if (__first == __last) + return __first; + + auto __i = __first; + while (++__i != __last) { + if (std::invoke(__pred, std::invoke(__proj, *__first), std::invoke(__proj, *__i))) + return __first; + __first = __i; + } + return __i; + } + + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, + class _Proj = identity, + indirect_binary_predicate<projected<_Iter, _Proj>, projected<_Iter, _Proj>> _Pred = ranges::equal_to> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { + return __adjacent_find_impl(std::move(__first), std::move(__last), __pred, __proj); + } + + template <forward_range _Range, + class _Proj = identity, + indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>, + projected<iterator_t<_Range>, _Proj>> _Pred = ranges::equal_to> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const { + 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{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h new file mode 100644 index 0000000000..68359fb138 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_binary_search.h @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// 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_BINARY_SEARCH_H +#define _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H + +#include <__algorithm/iterator_operations.h> +#include <__algorithm/lower_bound.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __binary_search { +struct __fn { + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { + auto __ret = std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj); + return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first)); + } + + template <forward_range _Range, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { + auto __first = ranges::begin(__r); + auto __last = ranges::end(__r); + auto __ret = std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj); + return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first)); + } +}; +} // namespace __binary_search + +inline namespace __cpo { + inline constexpr auto binary_search = __binary_search::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h index 3cbcdc959d..670df26911 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h @@ -15,6 +15,7 @@ #include <__functional/ranges_operations.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> +#include <__iterator/iterator_traits.h> #include <__iterator/projected.h> #include <__ranges/access.h> #include <__ranges/concepts.h> 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 9080631f62..0f34ee9f2b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h @@ -15,6 +15,7 @@ #include <__functional/ranges_operations.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> +#include <__iterator/iterator_traits.h> #include <__iterator/projected.h> #include <__ranges/access.h> #include <__ranges/concepts.h> 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 new file mode 100644 index 0000000000..ae31d38e6a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_first_of.h @@ -0,0 +1,101 @@ +//===----------------------------------------------------------------------===// +// +// 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_FIRST_OF_H +#define _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_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 <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __find_first_of { +struct __fn { + + 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, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Pred& __pred, + _Proj1& __proj1, + _Proj2& __proj2) { + for (; __first1 != __last1; ++__first1) { + for (auto __j = __first2; __j != __last2; ++__j) { + if (std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__j))) + return __first1; + } + } + return __first1; + } + + template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, + forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2, + class _Pred = ranges::equal_to, + class _Proj1 = identity, + class _Proj2 = identity> + requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter1 operator()(_Iter1 __first1, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Pred __pred = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) const { + return __find_first_of_impl(std::move(__first1), std::move(__last1), + std::move(__first2), std::move(__last2), + __pred, + __proj1, + __proj2); + } + + template <input_range _Range1, + forward_range _Range2, + class _Pred = ranges::equal_to, + class _Proj1 = identity, + class _Proj2 = identity> + requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range1> operator()(_Range1&& __range1, + _Range2&& __range2, + _Pred __pred = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) const { + return __find_first_of_impl(ranges::begin(__range1), ranges::end(__range1), + ranges::begin(__range2), ranges::end(__range2), + __pred, + __proj1, + __proj2); + } + +}; +} // namespace __find_first_of + +inline namespace __cpo { + inline constexpr auto find_first_of = __find_first_of::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h index f40f849a00..ddf8b047cd 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 @@ -15,6 +15,7 @@ #include <__functional/invoke.h> #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> +#include <__iterator/iterator_traits.h> #include <__iterator/projected.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h new file mode 100644 index 0000000000..a73470465c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_lower_bound.h @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H +#define _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H + +#include <__algorithm/iterator_operations.h> +#include <__algorithm/lower_bound.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/advance.h> +#include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { + +namespace __lower_bound { +struct __fn { + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { + return std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp, __proj); + } + + template <forward_range _Range, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __r, + const _Type& __value, + _Comp __comp = {}, + _Proj __proj = {}) const { + return std::__lower_bound_impl<_RangesIterOps>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj); + } +}; +} // namespace __lower_bound + +inline namespace __cpo { + inline constexpr auto lower_bound = __lower_bound::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h new file mode 100644 index 0000000000..5e74c3ff80 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace.h @@ -0,0 +1,74 @@ +//===----------------------------------------------------------------------===// +// +// 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_REPLACE_H +#define _LIBCPP___ALGORITHM_RANGES_REPLACE_H + +#include <__algorithm/ranges_replace_if.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __replace { +struct __fn { + + 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*> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, + const _Type1& __old_value, + const _Type2& __new_value, + _Proj __proj = {}) const { + auto __pred = [&](const auto& __val) { return __val == __old_value; }; + return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj); + } + + template <input_range _Range, + class _Type1, + class _Type2, + class _Proj = identity> + requires indirectly_writable<iterator_t<_Range>, const _Type2&> + && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type1*> + _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> + operator()(_Range&& __range, const _Type1& __old_value, const _Type2& __new_value, _Proj __proj = {}) const { + auto __pred = [&](auto&& __val) { return __val == __old_value; }; + 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{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.h new file mode 100644 index 0000000000..0f9555fc35 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_replace_if.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___ALGORITHM_RANGES_REPLACE_IF_H +#define _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H + +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { + +template <class _Iter, class _Sent, class _Type, class _Proj, class _Pred> +_LIBCPP_HIDE_FROM_ABI constexpr +_Iter __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) { + for (; __first != __last; ++__first) { + if (std::invoke(__pred, std::invoke(__proj, *__first))) + *__first = __new_value; + } + return __first; +} + +namespace __replace_if { +struct __fn { + + template <input_iterator _Iter, sentinel_for<_Iter> _Sent, + class _Type, + class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + requires indirectly_writable<_Iter, const _Type&> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const { + return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj); + } + + template <input_range _Range, + class _Type, + class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + requires indirectly_writable<iterator_t<_Range>, const _Type&> + _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> + operator()(_Range&& __range, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const { + 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{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined (_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h new file mode 100644 index 0000000000..94b5269c86 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_upper_bound.h @@ -0,0 +1,75 @@ +//===----------------------------------------------------------------------===// +// +// 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_UPPER_BOUND_H +#define _LIBCPP___ALGORITHM_RANGES_UPPER_BOUND_H + +#include <__algorithm/iterator_operations.h> +#include <__algorithm/lower_bound.h> +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/projected.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__ranges/dangling.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __upper_bound { +struct __fn { + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { + auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) { + return !std::invoke(__comp, __rhs, __lhs); + }; + + return std::__lower_bound_impl<_RangesIterOps>(__first, __last, __value, __comp_lhs_rhs_swapped, __proj); + } + + template <forward_range _Range, class _Type, class _Proj = identity, + indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __r, + const _Type& __value, + _Comp __comp = {}, + _Proj __proj = {}) const { + auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) { + return !std::invoke(__comp, __rhs, __lhs); + }; + + return std::__lower_bound_impl<_RangesIterOps>(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{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_UPPER_BOUND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h index ec7b999c5b..c9ea5bad4c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/rotate.h @@ -18,7 +18,7 @@ #include <__iterator/prev.h> #include <__utility/move.h> #include <__utility/swap.h> -#include <iterator> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h index 5234961082..e04466a08d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sample.h @@ -12,8 +12,10 @@ #include <__algorithm/min.h> #include <__assert> #include <__config> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> #include <__random/uniform_int_distribution.h> -#include <iterator> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h index 647aa3f067..6c6ff5675d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/shuffle.h @@ -10,6 +10,7 @@ #define _LIBCPP___ALGORITHM_SHUFFLE_H #include <__config> +#include <__debug> #include <__iterator/iterator_traits.h> #include <__random/uniform_int_distribution.h> #include <__utility/swap.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h index b5eaf75055..0f463e14cc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h @@ -16,7 +16,9 @@ #include <__algorithm/unwrap_iter.h> #include <__bits> #include <__config> +#include <__debug> #include <__functional/operations.h> +#include <__iterator/iterator_traits.h> #include <__utility/swap.h> #include <climits> #include <memory> @@ -531,43 +533,43 @@ inline _LIBCPP_INLINE_VISIBILITY void __sort(_Tp** __first, _Tp** __last, __less _VSTD::__sort<__less<uintptr_t>&, uintptr_t*>((uintptr_t*)__first, (uintptr_t*)__last, __comp); } -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&)) +extern template _LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&)) +extern template _LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); #endif -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<short>&, short*>(short*, short*, __less<short>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<int>&, int*>(int*, int*, __less<int>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long>&, long*>(long*, long*, __less<long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<float>&, float*>(float*, float*, __less<float>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&)) - -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&)) +extern template _LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<short>&, short*>(short*, short*, __less<short>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<int>&, int*>(int*, int*, __less<int>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<long>&, long*>(long*, long*, __less<long>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<float>&, float*>(float*, float*, __less<float>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&); +extern template _LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); + +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&)) +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); #endif -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&)) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&)) - -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&)) +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&); +extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); + +extern template _LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); template <class _RandomAccessIterator, class _Compare> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h index 1233cc157f..a0f1360691 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/stable_partition.h @@ -11,6 +11,8 @@ #include <__algorithm/rotate.h> #include <__config> +#include <__iterator/advance.h> +#include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__utility/swap.h> #include <memory> diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h index 2edf16b70d..be33194164 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/unwrap_iter.h @@ -10,8 +10,8 @@ #define _LIBCPP___ALGORITHM_UNWRAP_ITER_H #include <__config> +#include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> -#include <iterator> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -43,7 +43,7 @@ struct __unwrap_iter_impl { } }; -#if _LIBCPP_DEBUG_LEVEL < 2 +#ifndef _LIBCPP_ENABLE_DEBUG_MODE template <class _Iter> struct __unwrap_iter_impl<_Iter, true> { @@ -53,7 +53,7 @@ struct __unwrap_iter_impl<_Iter, true> { } }; -#endif // _LIBCPP_DEBUG_LEVEL < 2 +#endif // !_LIBCPP_ENABLE_DEBUG_MODE template<class _Iter, class _Impl = __unwrap_iter_impl<_Iter> > inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h index cfa021e142..c6483607e3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/upper_bound.h @@ -12,7 +12,9 @@ #include <__algorithm/comp.h> #include <__algorithm/half_positive.h> #include <__config> -#include <iterator> +#include <__iterator/advance.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__assert b/contrib/libs/cxxsupp/libcxx/include/__assert index 56b95dd5fb..57228e7671 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assert +++ b/contrib/libs/cxxsupp/libcxx/include/__assert @@ -19,7 +19,15 @@ // This is for backwards compatibility with code that might have been enabling // assertions through the Debug mode previously. -#if _LIBCPP_DEBUG_LEVEL >= 1 +// TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG +#if defined(_LIBCPP_DEBUG) +# ifndef _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ENABLE_ASSERTIONS 1 +# endif +#endif + +// Automatically enable assertions when the debug mode is enabled. +#if defined(_LIBCPP_ENABLE_DEBUG_MODE) # ifndef _LIBCPP_ENABLE_ASSERTIONS # define _LIBCPP_ENABLE_ASSERTIONS 1 # endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__availability b/contrib/libs/cxxsupp/libcxx/include/__availability index 789e26679f..f9d824509f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__availability +++ b/contrib/libs/cxxsupp/libcxx/include/__availability @@ -135,9 +135,6 @@ # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem - // This controls the availability of std::to_chars for integral arguments. -# define _LIBCPP_AVAILABILITY_TO_CHARS - // This controls the availability of floating-point std::to_chars functions. // These overloads were added later than the integer overloads. # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT @@ -253,9 +250,6 @@ # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem # endif -# define _LIBCPP_AVAILABILITY_TO_CHARS \ - _LIBCPP_AVAILABILITY_FILESYSTEM - # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \ __attribute__((unavailable)) diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h index 10c2c94281..c5b5cfa5c6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/bit_cast.h @@ -22,14 +22,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 -template<class _ToType, class _FromType, class = enable_if_t< - sizeof(_ToType) == sizeof(_FromType) && - is_trivially_copyable_v<_ToType> && - is_trivially_copyable_v<_FromType> ->> -_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI -constexpr _ToType bit_cast(_FromType const& __from) noexcept { - return __builtin_bit_cast(_ToType, __from); +template <class _ToType, class _FromType> + requires(sizeof(_ToType) == sizeof(_FromType) && + is_trivially_copyable_v<_ToType> && + is_trivially_copyable_v<_FromType>) +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _ToType bit_cast(const _FromType& __from) noexcept { + return __builtin_bit_cast(_ToType, __from); } #else _LIBCPP_STD_VER > 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/tables.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/tables.h new file mode 100644 index 0000000000..a2f7f7ce29 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/tables.h @@ -0,0 +1,130 @@ +// -*- 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___CHARCONV_TABLES +#define _LIBCPP___CHARCONV_TABLES + +#include <__config> +#include <cstdint> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_CXX03_LANG + +namespace __itoa { + +/// Contains the charconv helper tables. +/// +/// In C++17 these could be inline constexpr variable, but libc++ supports +/// charconv for integrals in C++11 mode. +template <class = void> +struct __table { + static const char __base_2_lut[64]; + static const char __base_8_lut[128]; + static const char __base_16_lut[512]; + + static const uint32_t __pow10_32[10]; + static const uint64_t __pow10_64[20]; + static const char __digits_base_10[200]; +}; + +template <class _Tp> +const char __table<_Tp>::__base_2_lut[64] = { + '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', + '0', '1', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0', '0', '1', '0', '0', '1', '1', '0', '1', '0', + '1', '0', '1', '1', '1', '1', '0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '1'}; + +template <class _Tp> +const char __table<_Tp>::__base_8_lut[128] = { + '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '1', '0', '1', '1', '1', '2', + '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', + '2', '6', '2', '7', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '4', '0', + '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '5', '0', '5', '1', '5', '2', '5', '3', + '5', '4', '5', '5', '5', '6', '5', '7', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', + '6', '7', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'}; + +template <class _Tp> +const char __table<_Tp>::__base_16_lut[512] = { + '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0', + 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', + '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', '2', '0', '2', '1', '2', + '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '2', 'a', '2', 'b', '2', 'c', '2', 'd', + '2', 'e', '2', 'f', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', + '9', '3', 'a', '3', 'b', '3', 'c', '3', 'd', '3', 'e', '3', 'f', '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', + '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '4', 'a', '4', 'b', '4', 'c', '4', 'd', '4', 'e', '4', 'f', '5', + '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '5', 'a', '5', 'b', + '5', 'c', '5', 'd', '5', 'e', '5', 'f', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', + '7', '6', '8', '6', '9', '6', 'a', '6', 'b', '6', 'c', '6', 'd', '6', 'e', '6', 'f', '7', '0', '7', '1', '7', '2', + '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '7', 'a', '7', 'b', '7', 'c', '7', 'd', '7', + 'e', '7', 'f', '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', + '8', 'a', '8', 'b', '8', 'c', '8', 'd', '8', 'e', '8', 'f', '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', + '5', '9', '6', '9', '7', '9', '8', '9', '9', '9', 'a', '9', 'b', '9', 'c', '9', 'd', '9', 'e', '9', 'f', 'a', '0', + 'a', '1', 'a', '2', 'a', '3', 'a', '4', 'a', '5', 'a', '6', 'a', '7', 'a', '8', 'a', '9', 'a', 'a', 'a', 'b', 'a', + 'c', 'a', 'd', 'a', 'e', 'a', 'f', 'b', '0', 'b', '1', 'b', '2', 'b', '3', 'b', '4', 'b', '5', 'b', '6', 'b', '7', + 'b', '8', 'b', '9', 'b', 'a', 'b', 'b', 'b', 'c', 'b', 'd', 'b', 'e', 'b', 'f', 'c', '0', 'c', '1', 'c', '2', 'c', + '3', 'c', '4', 'c', '5', 'c', '6', 'c', '7', 'c', '8', 'c', '9', 'c', 'a', 'c', 'b', 'c', 'c', 'c', 'd', 'c', 'e', + 'c', 'f', 'd', '0', 'd', '1', 'd', '2', 'd', '3', 'd', '4', 'd', '5', 'd', '6', 'd', '7', 'd', '8', 'd', '9', 'd', + 'a', 'd', 'b', 'd', 'c', 'd', 'd', 'd', 'e', 'd', 'f', 'e', '0', 'e', '1', 'e', '2', 'e', '3', 'e', '4', 'e', '5', + 'e', '6', 'e', '7', 'e', '8', 'e', '9', 'e', 'a', 'e', 'b', 'e', 'c', 'e', 'd', 'e', 'e', 'e', 'f', 'f', '0', 'f', + '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c', + 'f', 'd', 'f', 'e', 'f', 'f'}; + +template <class _Tp> +const uint32_t __table<_Tp>::__pow10_32[10] = { + UINT32_C(0), UINT32_C(10), UINT32_C(100), UINT32_C(1000), UINT32_C(10000), + UINT32_C(100000), UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), UINT32_C(1000000000)}; + +template <class _Tp> +const uint64_t __table<_Tp>::__pow10_64[20] = {UINT64_C(0), + UINT64_C(10), + UINT64_C(100), + UINT64_C(1000), + UINT64_C(10000), + UINT64_C(100000), + UINT64_C(1000000), + UINT64_C(10000000), + UINT64_C(100000000), + UINT64_C(1000000000), + UINT64_C(10000000000), + UINT64_C(100000000000), + UINT64_C(1000000000000), + UINT64_C(10000000000000), + UINT64_C(100000000000000), + UINT64_C(1000000000000000), + UINT64_C(10000000000000000), + UINT64_C(100000000000000000), + UINT64_C(1000000000000000000), + UINT64_C(10000000000000000000)}; + +template <class _Tp> +const char __table<_Tp>::__digits_base_10[200] = { + // clang-format off + '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', + '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', + '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', + '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', + '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', + '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', + '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', + '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', + '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', + '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9'}; +// clang-format on + +} // namespace __itoa + +#endif // _LIBCPP_CXX03_LANG + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CHARCONV_TABLES diff --git a/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h new file mode 100644 index 0000000000..1c6804a852 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__charconv/to_chars_base_10.h @@ -0,0 +1,128 @@ +// -*- 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___CHARCONV_TO_CHARS_BASE_10_H +#define _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H + +#include <__charconv/tables.h> +#include <__config> +#include <cstdint> +#include <cstring> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_CXX03_LANG + +namespace __itoa { + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append1(char* __buffer, _Tp __value) noexcept { + *__buffer = '0' + static_cast<char>(__value); + return __buffer + 1; +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append2(char* __buffer, _Tp __value) noexcept { + std::memcpy(__buffer, &__table<>::__digits_base_10[(__value)*2], 2); + return __buffer + 2; +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append3(char* __buffer, _Tp __value) noexcept { + return __itoa::__append2(__itoa::__append1(__buffer, (__value) / 100), (__value) % 100); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append4(char* __buffer, _Tp __value) noexcept { + return __itoa::__append2(__itoa::__append2(__buffer, (__value) / 100), (__value) % 100); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append2_no_zeros(char* __buffer, _Tp __value) noexcept { + if (__value < 10) + return __itoa::__append1(__buffer, __value); + else + return __itoa::__append2(__buffer, __value); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append4_no_zeros(char* __buffer, _Tp __value) noexcept { + if (__value < 100) + return __itoa::__append2_no_zeros(__buffer, __value); + else if (__value < 1000) + return __itoa::__append3(__buffer, __value); + else + return __itoa::__append4(__buffer, __value); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI char* __append8_no_zeros(char* __buffer, _Tp __value) noexcept { + if (__value < 10000) + __buffer = __itoa::__append4_no_zeros(__buffer, __value); + else { + __buffer = __itoa::__append4_no_zeros(__buffer, __value / 10000); + __buffer = __itoa::__append4(__buffer, __value % 10000); + } + return __buffer; +} + +_LIBCPP_HIDE_FROM_ABI inline char* __base_10_u32(uint32_t __value, char* __buffer) noexcept { + if (__value < 100000000) + __buffer = __itoa::__append8_no_zeros(__buffer, __value); + else { + // __value = aabbbbcccc in decimal + const uint32_t __a = __value / 100000000; // 1 to 42 + __value %= 100000000; + + __buffer = __itoa::__append2_no_zeros(__buffer, __a); + __buffer = __itoa::__append4(__buffer, __value / 10000); + __buffer = __itoa::__append4(__buffer, __value % 10000); + } + + return __buffer; +} + +_LIBCPP_HIDE_FROM_ABI inline char* __base_10_u64(uint64_t __value, char* __buffer) noexcept { + if (__value < 100000000) + __buffer = __itoa::__append8_no_zeros(__buffer, static_cast<uint32_t>(__value)); + else if (__value < 10000000000000000) { + const uint32_t __v0 = static_cast<uint32_t>(__value / 100000000); + const uint32_t __v1 = static_cast<uint32_t>(__value % 100000000); + + __buffer = __itoa::__append8_no_zeros(__buffer, __v0); + __buffer = __itoa::__append4(__buffer, __v1 / 10000); + __buffer = __itoa::__append4(__buffer, __v1 % 10000); + } else { + const uint32_t __a = static_cast<uint32_t>(__value / 10000000000000000); // 1 to 1844 + __value %= 10000000000000000; + + __buffer = __itoa::__append4_no_zeros(__buffer, __a); + + const uint32_t __v0 = static_cast<uint32_t>(__value / 100000000); + const uint32_t __v1 = static_cast<uint32_t>(__value % 100000000); + __buffer = __itoa::__append4(__buffer, __v0 / 10000); + __buffer = __itoa::__append4(__buffer, __v0 % 10000); + __buffer = __itoa::__append4(__buffer, __v1 / 10000); + __buffer = __itoa::__append4(__buffer, __v1 % 10000); + } + + return __buffer; +} + +} // namespace __itoa + +#endif // _LIBCPP_CXX03_LANG + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CHARCONV_TO_CHARS_BASE_10_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 12b2b97dd0..d575e2ef39 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -78,6 +78,8 @@ # define _LIBCPP_OBJECT_FORMAT_COFF 1 #elif defined(__wasm__) # define _LIBCPP_OBJECT_FORMAT_WASM 1 +#elif defined(_AIX) +# define _LIBCPP_OBJECT_FORMAT_XCOFF 1 #else // ... add new file formats here ... #endif @@ -147,13 +149,20 @@ # define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON // According to the Standard, `bitset::operator[] const` returns bool # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL +// Remove the base 10 implementation of std::to_chars from the dylib. +// The implementation moved to the header, but we still export the symbols from +// the dylib for backwards compatibility. +# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 #elif _LIBCPP_ABI_VERSION == 1 -# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF)||defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would -// conflict with the dllexport-emitted copy, so we disable it. +// conflict with the dllexport-emitted copy, so we disable it. For XCOFF, +// the linker will take issue with the symbols in the shared object if the +// weak inline methods get visibility (such as from -fvisibility-inlines-hidden), +// so disable it. # define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS # endif // Feature macros for disabling pre ABI v1 features. All of these options @@ -178,7 +187,7 @@ #define _LIBCPP_TOSTRING2(x) #x #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#if __cplusplus < 201103L && !defined(_LIBCPP_COMPILER_MSVC) +#if __cplusplus < 201103L #define _LIBCPP_CXX03_LANG #endif @@ -589,7 +598,7 @@ typedef __char32_t char32_t; # define _LIBCPP_CRT_FUNC #endif -#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) # define _LIBCPP_DLL_VIS # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS @@ -730,12 +739,8 @@ typedef __char32_t char32_t; // Try to approximate the effect of exclude_from_explicit_instantiation // (which is that entities are not assumed to be provided by explicit // template instantiations in the dylib) by always inlining those entities. -#ifdef _LIBCPP_COMPILER_MSVC -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION -#else # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE #endif -#endif #ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU # ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT @@ -848,60 +853,6 @@ typedef unsigned int char32_t; # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) #endif // _LIBCPP_CXX03_LANG -// _LIBCPP_DEBUG potential values: -// - undefined: No assertions. This is the default. -// - 0: Basic assertions -// - 1: Basic assertions + iterator validity checks + unspecified behavior randomization. -# if !defined(_LIBCPP_DEBUG) -# define _LIBCPP_DEBUG_LEVEL 0 -# elif _LIBCPP_DEBUG == 0 -# define _LIBCPP_DEBUG_LEVEL 1 -# elif _LIBCPP_DEBUG == 1 -# define _LIBCPP_DEBUG_LEVEL 2 -# else -# error Supported values for _LIBCPP_DEBUG are 0 and 1 -# endif - -# if _LIBCPP_DEBUG_LEVEL >= 2 && !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY -# endif - -# if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) -# if defined(_LIBCPP_CXX03_LANG) -# error Support for unspecified stability is only for C++11 and higher -# endif -# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \ - do { \ - if (!__builtin_is_constant_evaluated()) \ - _VSTD::shuffle(__first, __last, __libcpp_debug_randomizer()); \ - } while (false) -# else -# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \ - do { \ - } while (false) -# endif - -// Libc++ allows disabling extern template instantiation declarations by -// means of users defining _LIBCPP_DISABLE_EXTERN_TEMPLATE. -// -// Furthermore, when the Debug mode is enabled, we disable extern declarations -// when building user code because we don't want to use the functions compiled -// in the library, which might not have had the debug mode enabled when built. -// However, some extern declarations need to be used, because code correctness -// depends on it (several instances in <locale>). Those special declarations -// are declared with _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled -// even when the debug mode is enabled. -#if defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) /* nothing */ -#elif _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#else -# define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#endif - #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ defined(__sun__) || defined(__NetBSD__) #define _LIBCPP_LOCALE__L_EXTENSIONS 1 @@ -986,6 +937,7 @@ typedef unsigned int char32_t; # define _LIBCPP_DEPRECATED_WITH_CHAR8_T #endif +// Macros to enter and leave a state where deprecation warnings are suppressed. #if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ _Pragma("GCC diagnostic push") \ @@ -1180,7 +1132,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( #if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \ !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ - !defined(_LIBCPP_COMPILER_MSVC) && \ !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP) # define _LIBCPP_HAS_NO_ATOMIC_HEADER #else @@ -1214,7 +1165,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) #endif -#if _LIBCPP_STD_VER > 17 && (!defined(_MSC_VER) || _MSC_VER >= 1929) +#if _LIBCPP_STD_VER > 17 # define _LIBCPP_CONSTINIT constinit #elif __has_attribute(require_constant_initialization) # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) @@ -1336,12 +1287,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( # define _LIBCPP_FOPEN_CLOEXEC_MODE #endif -#ifdef _LIBCPP_COMPILER_MSVC -#define _LIBCPP_BUILTIN_CONSTANT_P(x) false -#else -#define _LIBCPP_BUILTIN_CONSTANT_P(x) __builtin_constant_p(x) -#endif - // Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set // of functions used in cstdio may not be available for low API levels when // using 64-bit file offsets on LP32. diff --git a/contrib/libs/cxxsupp/libcxx/include/__debug b/contrib/libs/cxxsupp/libcxx/include/__debug index 39539af0e9..403710600b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__debug +++ b/contrib/libs/cxxsupp/libcxx/include/__debug @@ -18,23 +18,44 @@ # pragma GCC system_header #endif -#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY) -# include <cstddef> -# include <cstdio> -# include <cstdlib> +// Catch invalid uses of the legacy _LIBCPP_DEBUG toggle. +#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE) +# error "Enabling the debug mode now requires having configured the library with support for the debug mode" #endif -#if _LIBCPP_DEBUG_LEVEL == 0 || _LIBCPP_DEBUG_LEVEL == 1 -# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) -#elif _LIBCPP_DEBUG_LEVEL == 2 +#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) +# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY +#endif + +// TODO: Define this as a function instead +#if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) +# if defined(_LIBCPP_CXX03_LANG) +# error Support for unspecified stability is only for C++11 and higher +# endif +# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \ + do { \ + if (!__builtin_is_constant_evaluated()) \ + std::shuffle(__first, __last, __libcpp_debug_randomizer()); \ + } while (false) +#else +# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \ + do { \ + } while (false) +#endif + +#ifdef _LIBCPP_ENABLE_DEBUG_MODE # define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m) #else -# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2 +# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) #endif -_LIBCPP_BEGIN_NAMESPACE_STD +#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY) + +#include <cstddef> +#include <cstdio> +#include <cstdlib> -#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +_LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_TYPE_VIS __c_node; @@ -203,12 +224,15 @@ private: _LIBCPP_FUNC_VIS __libcpp_db* __get_db(); _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); +_LIBCPP_END_NAMESPACE_STD + +#endif // defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY) -#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +_LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_c(__c); #else @@ -218,7 +242,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_i(__i); #else @@ -228,7 +252,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__erase_c(__c); #else @@ -238,7 +262,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->swap(__lhs, __rhs); #else @@ -249,7 +273,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap( template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__invalidate_all(__c); #else diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h index 55cde0044e..d9b08064df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h @@ -119,7 +119,7 @@ class _LIBCPP_TEMPLATE_VIS __direct_storage {}; template <class _OutIt, class _CharT> concept __enable_direct_output = __formatter::__char_type<_CharT> && (same_as<_OutIt, _CharT*> -#if _LIBCPP_DEBUG_LEVEL < 2 +#ifndef _LIBCPP_ENABLE_DEBUG_MODE || same_as<_OutIt, __wrap_iter<_CharT*>> #endif ); 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 28c9c28d96..6602dfeb95 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg_store.h @@ -14,6 +14,8 @@ # pragma GCC system_header #endif +#include <__concepts/arithmetic.h> +#include <__concepts/same_as.h> #include <__config> #include <__format/concepts.h> #include <__format/format_arg.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h index e712a5ef43..b9a41db05d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h @@ -17,7 +17,9 @@ #include <__format/format_fwd.h> #include <__iterator/back_insert_iterator.h> #include <__iterator/concepts.h> +#include <__utility/move.h> #include <concepts> +#include <cstddef> #ifndef _LIBCPP_HAS_NO_LOCALIZATION #include <locale> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h index d7370b0bca..c39e25b354 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter.h @@ -15,6 +15,7 @@ #include <__algorithm/transform.h> #include <__assert> #include <__availability> +#include <__concepts/same_as.h> #include <__config> #include <__format/format_error.h> #include <__format/format_fwd.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h index e3653e6738..4f219c2b4e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_bool.h @@ -10,6 +10,7 @@ #ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_H #define _LIBCPP___FORMAT_FORMATTER_BOOL_H +#include <__algorithm/copy.h> #include <__availability> #include <__config> #include <__format/format_error.h> 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 10df1ba51b..8c66e4e8fa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_floating_point.h @@ -19,6 +19,7 @@ #include <__algorithm/transform.h> #include <__assert> #include <__concepts/arithmetic.h> +#include <__concepts/same_as.h> #include <__config> #include <__format/format_error.h> #include <__format/format_fwd.h> @@ -26,6 +27,7 @@ #include <__format/formatter.h> #include <__format/formatter_integral.h> #include <__format/parser_std_format_spec.h> +#include <__memory/allocator.h> #include <__utility/move.h> #include <__utility/unreachable.h> #include <charconv> 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 d58ad11ea0..7a0efe10ff 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 @@ -252,25 +252,21 @@ public: /** Determines whether the value stored is a width or an arg-id. */ uint32_t __width_as_arg : 1 {0}; -protected: /** - * Does the supplied std-format-spec contain a width field? + * Does the supplied width field contain an arg-id? * - * When the field isn't present there's no padding required. This can be used - * to optimize the formatting. + * If @c true the formatter needs to call @ref __substitute_width_arg_id. */ - constexpr bool __has_width_field() const noexcept { - return __width_as_arg || __width; - } + constexpr bool __width_needs_substitution() const noexcept { return __width_as_arg; } +protected: /** - * Does the supplied width field contain an arg-id? + * Does the supplied std-format-spec contain a width field? * - * If @c true the formatter needs to call @ref __substitute_width_arg_id. + * When the field isn't present there's no padding required. This can be used + * to optimize the formatting. */ - constexpr bool __width_needs_substitution() const noexcept { - return __width_as_arg; - } + constexpr bool __has_width_field() const noexcept { return __width_as_arg || __width; } template <class _CharT> _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* @@ -327,6 +323,15 @@ public: */ uint32_t __precision_as_arg : 1 {1}; + /** + * Does the supplied precision field contain an arg-id? + * + * If @c true the formatter needs to call @ref __substitute_precision_arg_id. + */ + constexpr bool __precision_needs_substitution() const noexcept { + return __precision_as_arg && __precision != __format::__number_max; + } + protected: /** * Does the supplied std-format-spec contain a precision field? @@ -340,15 +345,6 @@ protected: __precision != __format::__number_max; // The arg-id is valid? } - /** - * Does the supplied precision field contain an arg-id? - * - * If @c true the formatter needs to call @ref __substitute_precision_arg_id. - */ - constexpr bool __precision_needs_substitution() const noexcept { - return __precision_as_arg && __precision != __format::__number_max; - } - template <class _CharT> _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __parse(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h index b4c3e76562..7381462ffc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h @@ -11,79 +11,526 @@ #define _LIBCPP___FUNCTIONAL_INVOKE_H #include <__config> -#include <__functional/weak_result_type.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/apply_cv.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_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_reference_wrapper.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_void.h> +#include <__type_traits/remove_cv.h> +#include <__utility/declval.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +// TODO: Disentangle the type traits and std::invoke properly + _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Ret, bool = is_void<_Ret>::value> -struct __invoke_void_return_wrapper +struct __any +{ + __any(...); +}; + +struct __nat { #ifndef _LIBCPP_CXX03_LANG - template <class ..._Args> - static _Ret __call(_Args&&... __args) { - return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); - } -#else - template <class _Fn> - static _Ret __call(_Fn __f) { - return _VSTD::__invoke(__f); - } + __nat() = delete; + __nat(const __nat&) = delete; + __nat& operator=(const __nat&) = delete; + ~__nat() = delete; +#endif +}; - template <class _Fn, class _A0> - static _Ret __call(_Fn __f, _A0& __a0) { - return _VSTD::__invoke(__f, __a0); - } +template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> +struct __member_pointer_traits_imp +{ +}; - template <class _Fn, class _A0, class _A1> - static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) { - return _VSTD::__invoke(__f, __a0, __a1); - } +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> +{ + typedef _Class const _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> +{ + typedef _Class const _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> +{ + typedef _Class volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> +{ + typedef _Class volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> +{ + typedef _Class const volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> +{ + typedef _Class const volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> +{ + typedef _Class& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> +{ + typedef _Class& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> +{ + typedef _Class const& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> +{ + typedef _Class const& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> +{ + typedef _Class volatile& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> +{ + typedef _Class volatile& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> +{ + typedef _Class const volatile& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> +{ + typedef _Class const volatile& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> +{ + typedef _Class&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> +{ + typedef _Class&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> +{ + typedef _Class const&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> +{ + typedef _Class const&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> +{ + typedef _Class volatile&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> +{ + typedef _Class volatile&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> +{ + typedef _Class const volatile&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param...); +}; + +template <class _Rp, class _Class, class ..._Param> +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> +{ + typedef _Class const volatile&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + +template <class _Rp, class _Class> +struct __member_pointer_traits_imp<_Rp _Class::*, false, true> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; +}; + +template <class _MP> +struct __member_pointer_traits + : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, + is_member_function_pointer<_MP>::value, + is_member_object_pointer<_MP>::value> +{ +// typedef ... _ClassType; +// typedef ... _ReturnType; +// typedef ... _FnType; +}; + +template <class _DecayedFp> +struct __member_pointer_class_type {}; + +template <class _Ret, class _ClassType> +struct __member_pointer_class_type<_Ret _ClassType::*> { + typedef _ClassType type; +}; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet1 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && is_base_of<_ClassT, _DecayA0>::value + >::type; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type> +using __enable_if_bullet2 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && __is_reference_wrapper<_DecayA0>::value + >::type; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet3 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && !is_base_of<_ClassT, _DecayA0>::value + && !__is_reference_wrapper<_DecayA0>::value + >::type; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet4 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && is_base_of<_ClassT, _DecayA0>::value + >::type; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type> +using __enable_if_bullet5 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && __is_reference_wrapper<_DecayA0>::value + >::type; + +template <class _Fp, class _A0, + class _DecayFp = typename decay<_Fp>::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet6 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && !is_base_of<_ClassT, _DecayA0>::value + && !__is_reference_wrapper<_DecayA0>::value + >::type; + +// __invoke forward declarations + +// fall back - none of the bullets + +template <class ..._Args> +__nat __invoke(__any, _Args&& ...__args); + +// bullets 1, 2 and 3 + +template <class _Fp, class _A0, class ..._Args, + class = __enable_if_bullet1<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().*std::declval<_Fp>())(std::declval<_Args>()...)) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + _NOEXCEPT_(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) + { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } + +template <class _Fp, class _A0, class ..._Args, + class = __enable_if_bullet2<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().get().*std::declval<_Fp>())(std::declval<_Args>()...)) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + _NOEXCEPT_(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) + { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } + +template <class _Fp, class _A0, class ..._Args, + class = __enable_if_bullet3<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype(((*std::declval<_A0>()).*std::declval<_Fp>())(std::declval<_Args>()...)) +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + _NOEXCEPT_(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) + { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } + +// bullets 4, 5 and 6 + +template <class _Fp, class _A0, + class = __enable_if_bullet4<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().*std::declval<_Fp>()) +__invoke(_Fp&& __f, _A0&& __a0) + _NOEXCEPT_(noexcept(static_cast<_A0&&>(__a0).*__f)) + { return static_cast<_A0&&>(__a0).*__f; } + +template <class _Fp, class _A0, + class = __enable_if_bullet5<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().get().*std::declval<_Fp>()) +__invoke(_Fp&& __f, _A0&& __a0) + _NOEXCEPT_(noexcept(__a0.get().*__f)) + { return __a0.get().*__f; } + +template <class _Fp, class _A0, + class = __enable_if_bullet6<_Fp, _A0> > +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype((*std::declval<_A0>()).*std::declval<_Fp>()) +__invoke(_Fp&& __f, _A0&& __a0) + _NOEXCEPT_(noexcept((*static_cast<_A0&&>(__a0)).*__f)) + { return (*static_cast<_A0&&>(__a0)).*__f; } + +// bullet 7 + +template <class _Fp, class ..._Args> +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR decltype(std::declval<_Fp>()(std::declval<_Args>()...)) +__invoke(_Fp&& __f, _Args&& ...__args) + _NOEXCEPT_(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) + { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } + +// __invokable +template <class _Ret, class _Fp, class ..._Args> +struct __invokable_r +{ + template <class _XFp, class ..._XArgs> + static decltype(std::__invoke(declval<_XFp>(), declval<_XArgs>()...)) __try_call(int); + template <class _XFp, class ..._XArgs> + static __nat __try_call(...); + + // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, + // or incomplete array types as required by the standard. + using _Result = decltype(__try_call<_Fp, _Args...>(0)); + + using type = typename conditional< + _IsNotSame<_Result, __nat>::value, + typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type, + false_type >::type; + static const bool value = type::value; +}; +template <class _Fp, class ..._Args> +using __invokable = __invokable_r<void, _Fp, _Args...>; + +template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> +struct __nothrow_invokable_r_imp { + static const bool value = false; +}; + +template <class _Ret, class _Fp, class ..._Args> +struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> +{ + typedef __nothrow_invokable_r_imp _ThisT; + + template <class _Tp> + static void __test_noexcept(_Tp) _NOEXCEPT; + + static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( + _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...))); +}; - template <class _Fn, class _A0, class _A1, class _A2> - static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){ - return _VSTD::__invoke(__f, __a0, __a1, __a2); +template <class _Ret, class _Fp, class ..._Args> +struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> +{ + static const bool value = noexcept( + _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)); +}; + +template <class _Ret, class _Fp, class ..._Args> +using __nothrow_invokable_r = + __nothrow_invokable_r_imp< + __invokable_r<_Ret, _Fp, _Args...>::value, + is_void<_Ret>::value, + _Ret, _Fp, _Args... + >; + +template <class _Fp, class ..._Args> +using __nothrow_invokable = + __nothrow_invokable_r_imp< + __invokable<_Fp, _Args...>::value, + true, void, _Fp, _Args... + >; + +template <class _Fp, class ..._Args> +struct __invoke_of + : public enable_if< + __invokable<_Fp, _Args...>::value, + typename __invokable_r<void, _Fp, _Args...>::_Result> +{ +}; + +template <class _Ret, bool = is_void<_Ret>::value> +struct __invoke_void_return_wrapper +{ + template <class ..._Args> + static _Ret __call(_Args&&... __args) { + return std::__invoke(std::forward<_Args>(__args)...); } -#endif }; template <class _Ret> struct __invoke_void_return_wrapper<_Ret, true> { -#ifndef _LIBCPP_CXX03_LANG template <class ..._Args> static void __call(_Args&&... __args) { - _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); - } -#else - template <class _Fn> - static void __call(_Fn __f) { - _VSTD::__invoke(__f); + std::__invoke(std::forward<_Args>(__args)...); } +}; - template <class _Fn, class _A0> - static void __call(_Fn __f, _A0& __a0) { - _VSTD::__invoke(__f, __a0); - } +#if _LIBCPP_STD_VER > 14 - template <class _Fn, class _A0, class _A1> - static void __call(_Fn __f, _A0& __a0, _A1& __a1) { - _VSTD::__invoke(__f, __a0, __a1); - } +// is_invocable - template <class _Fn, class _A0, class _A1, class _A2> - static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) { - _VSTD::__invoke(__f, __a0, __a1, __a2); - } -#endif +template <class _Fn, class ..._Args> +struct _LIBCPP_TEMPLATE_VIS is_invocable + : integral_constant<bool, __invokable<_Fn, _Args...>::value> {}; + +template <class _Ret, class _Fn, class ..._Args> +struct _LIBCPP_TEMPLATE_VIS is_invocable_r + : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; + +template <class _Fn, class ..._Args> +inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; + +template <class _Ret, class _Fn, class ..._Args> +inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; + +// is_nothrow_invocable + +template <class _Fn, class ..._Args> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable + : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {}; + +template <class _Ret, class _Fn, class ..._Args> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r + : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {}; + +template <class _Fn, class ..._Args> +inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; + +template <class _Ret, class _Fn, class ..._Args> +inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; + +template <class _Fn, class... _Args> +struct _LIBCPP_TEMPLATE_VIS invoke_result + : __invoke_of<_Fn, _Args...> +{ }; -#if _LIBCPP_STD_VER > 14 +template <class _Fn, class... _Args> +using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; template <class _Fn, class ..._Args> _LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h index 10967a8a14..c0018038db 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h @@ -39,114 +39,13 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} -#ifndef _LIBCPP_CXX03_LANG // invoke template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename __invoke_return<type, _ArgTypes...>::type operator() (_ArgTypes&&... __args) const { - return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); + return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...); } -#else - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0>::type - operator() (_A0& __a0) const { - return _VSTD::__invoke(__f_, __a0); - } - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0 const>::type - operator() (_A0 const& __a0) const { - return _VSTD::__invoke(__f_, __a0); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1>::type - operator() (_A0& __a0, _A1& __a1) const { - return _VSTD::__invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1>::type - operator() (_A0 const& __a0, _A1& __a1) const { - return _VSTD::__invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1 const>::type - operator() (_A0& __a0, _A1 const& __a1) const { - return _VSTD::__invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1 const>::type - operator() (_A0 const& __a0, _A1 const& __a1) const { - return _VSTD::__invoke(__f_, __a0, __a1); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2>::type - operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2>::type - operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2>::type - operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2 const>::type - operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type - operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type - operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(__f_, __a0, __a1, __a2); - } -#endif }; template<class _Rp, class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h index b7d2f87302..497276a080 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h @@ -51,120 +51,13 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 type& get() const _NOEXCEPT {return *__f_;} -#ifndef _LIBCPP_CXX03_LANG // invoke template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename __invoke_of<type&, _ArgTypes...>::type operator() (_ArgTypes&&... __args) const { - return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); + return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); } -#else - - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return<type>::type - operator() () const { - return _VSTD::__invoke(get()); - } - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0>::type - operator() (_A0& __a0) const { - return _VSTD::__invoke(get(), __a0); - } - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0 const>::type - operator() (_A0 const& __a0) const { - return _VSTD::__invoke(get(), __a0); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1>::type - operator() (_A0& __a0, _A1& __a1) const { - return _VSTD::__invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1>::type - operator() (_A0 const& __a0, _A1& __a1) const { - return _VSTD::__invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1 const>::type - operator() (_A0& __a0, _A1 const& __a1) const { - return _VSTD::__invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1 const>::type - operator() (_A0 const& __a0, _A1 const& __a1) const { - return _VSTD::__invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2>::type - operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2>::type - operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2>::type - operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2 const>::type - operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type - operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type - operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { - return _VSTD::__invoke(get(), __a0, __a1, __a2); - } -#endif // _LIBCPP_CXX03_LANG }; #if _LIBCPP_STD_VER > 14 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 1ab9008e7f..81e4bedd2d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/weak_result_type.h @@ -25,12 +25,10 @@ template <class _Tp> struct __has_result_type { private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. - template <class _Up> static char __test(decltype(std::declval<typename _Up::result_type*>()) = 0); + template <class _Up> static false_type __test(...); + template <class _Up> static true_type __test(typename _Up::result_type* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = decltype(__test<_Tp>(0))::value; }; // __weak_result_type @@ -214,8 +212,6 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> { }; - -#ifndef _LIBCPP_CXX03_LANG // 3 or more arguments template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> @@ -266,217 +262,6 @@ struct __invoke_return typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type; }; -#else // defined(_LIBCPP_CXX03_LANG) - -template <class _Ret, class _T1, bool _IsFunc, bool _IsBase> -struct __enable_invoke_imp; - -template <class _Ret, class _T1> -struct __enable_invoke_imp<_Ret, _T1, true, true> { - typedef _Ret _Bullet1; - typedef _Bullet1 type; -}; - -template <class _Ret, class _T1> -struct __enable_invoke_imp<_Ret, _T1, true, false> { - typedef _Ret _Bullet2; - typedef _Bullet2 type; -}; - -template <class _Ret, class _T1> -struct __enable_invoke_imp<_Ret, _T1, false, true> { - typedef typename add_lvalue_reference< - typename __apply_cv<_T1, _Ret>::type - >::type _Bullet3; - typedef _Bullet3 type; -}; - -template <class _Ret, class _T1> -struct __enable_invoke_imp<_Ret, _T1, false, false> { - typedef typename add_lvalue_reference< - typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type - >::type _Bullet4; - typedef _Bullet4 type; -}; - -template <class _Ret, class _T1> -struct __enable_invoke_imp<_Ret, _T1*, false, false> { - typedef typename add_lvalue_reference< - typename __apply_cv<_T1, _Ret>::type - >::type _Bullet4; - typedef _Bullet4 type; -}; - -template <class _Fn, class _T1, - class _Traits = __member_pointer_traits<_Fn>, - class _Ret = typename _Traits::_ReturnType, - class _Class = typename _Traits::_ClassType> -struct __enable_invoke : __enable_invoke_imp< - _Ret, _T1, - is_member_function_pointer<_Fn>::value, - is_base_of<_Class, typename remove_reference<_T1>::type>::value> -{ -}; - -__nat __invoke(__any, ...); - -// first bullet - -template <class _Fn, class _T1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet1 -__invoke(_Fn __f, _T1& __t1) { - return (__t1.*__f)(); -} - -template <class _Fn, class _T1, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet1 -__invoke(_Fn __f, _T1& __t1, _A0& __a0) { - return (__t1.*__f)(__a0); -} - -template <class _Fn, class _T1, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet1 -__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) { - return (__t1.*__f)(__a0, __a1); -} - -template <class _Fn, class _T1, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet1 -__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { - return (__t1.*__f)(__a0, __a1, __a2); -} - -template <class _Fn, class _T1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet2 -__invoke(_Fn __f, _T1& __t1) { - return ((*__t1).*__f)(); -} - -template <class _Fn, class _T1, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet2 -__invoke(_Fn __f, _T1& __t1, _A0& __a0) { - return ((*__t1).*__f)(__a0); -} - -template <class _Fn, class _T1, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet2 -__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) { - return ((*__t1).*__f)(__a0, __a1); -} - -template <class _Fn, class _T1, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet2 -__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) { - return ((*__t1).*__f)(__a0, __a1, __a2); -} - -template <class _Fn, class _T1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet3 -__invoke(_Fn __f, _T1& __t1) { - return __t1.*__f; -} - -template <class _Fn, class _T1> -inline _LIBCPP_INLINE_VISIBILITY -typename __enable_invoke<_Fn, _T1>::_Bullet4 -__invoke(_Fn __f, _T1& __t1) { - return (*__t1).*__f; -} - -// fifth bullet - -template <class _Fp> -inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_Fp&>()()) -__invoke(_Fp& __f) -{ - return __f(); -} - -template <class _Fp, class _A0> -inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_Fp&>()(declval<_A0&>())) -__invoke(_Fp& __f, _A0& __a0) -{ - return __f(__a0); -} - -template <class _Fp, class _A0, class _A1> -inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>())) -__invoke(_Fp& __f, _A0& __a0, _A1& __a1) -{ - return __f(__a0, __a1); -} - -template <class _Fp, class _A0, class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>())) -__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2) -{ - return __f(__a0, __a1, __a2); -} - -template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value> -struct __invoke_return -{ - typedef typename __weak_result_type<_Fp>::result_type type; -}; - -template <class _Fp> -struct __invoke_return<_Fp, false> -{ - typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type; -}; - -template <class _Tp, class _A0> -struct __invoke_return0 -{ - typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type; -}; - -template <class _Rp, class _Tp, class _A0> -struct __invoke_return0<_Rp _Tp::*, _A0> -{ - typedef typename __enable_invoke<_Rp _Tp::*, _A0>::type type; -}; - -template <class _Tp, class _A0, class _A1> -struct __invoke_return1 -{ - typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), - declval<_A1&>())) type; -}; - -template <class _Rp, class _Class, class _A0, class _A1> -struct __invoke_return1<_Rp _Class::*, _A0, _A1> { - typedef typename __enable_invoke<_Rp _Class::*, _A0>::type type; -}; - -template <class _Tp, class _A0, class _A1, class _A2> -struct __invoke_return2 -{ - typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), - declval<_A1&>(), - declval<_A2&>())) type; -}; - -template <class _Ret, class _Class, class _A0, class _A1, class _A2> -struct __invoke_return2<_Ret _Class::*, _A0, _A1, _A2> { - typedef typename __enable_invoke<_Ret _Class::*, _A0>::type type; -}; - -#endif // !defined(_LIBCPP_CXX03_LANG) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FUNCTIONAL_WEAK_RESULT_TYPE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__hash_table b/contrib/libs/cxxsupp/libcxx/include/__hash_table index 14f53429de..990f5efc74 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__hash_table +++ b/contrib/libs/cxxsupp/libcxx/include/__hash_table @@ -17,10 +17,10 @@ #include <__config> #include <__debug> #include <__functional/hash.h> +#include <__iterator/iterator_traits.h> #include <__utility/swap.h> #include <cmath> #include <initializer_list> -#include <iterator> #include <memory> #include <type_traits> @@ -301,7 +301,7 @@ public: _VSTD::__debug_db_insert_i(this); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __hash_iterator(const __hash_iterator& __i) : __node_(__i.__node_) @@ -325,7 +325,7 @@ public: } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -367,19 +367,15 @@ public: {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_iterator(__next_pointer __node) _NOEXCEPT - : __node_(__node) - {} #endif + } template <class, class, class, class> friend class __hash_table; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator; @@ -415,12 +411,12 @@ public: __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT : __node_(__x.__node_) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); #endif } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __hash_const_iterator(const __hash_const_iterator& __i) : __node_(__i.__node_) @@ -444,7 +440,7 @@ public: } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -485,19 +481,15 @@ public: {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT - : __node_(__node) - {} #endif + } template <class, class, class, class> friend class __hash_table; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map; @@ -526,7 +518,7 @@ public: _VSTD::__debug_db_insert_i(this); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __hash_local_iterator(const __hash_local_iterator& __i) : __node_(__i.__node_), @@ -554,7 +546,7 @@ public: } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -598,7 +590,6 @@ public: {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_local_iterator(__next_pointer __node, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -606,22 +597,13 @@ private: __bucket_(__bucket), __bucket_count_(__bucket_count) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); +#endif if (__node_ != nullptr) __node_ = __node_->__next_; } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_local_iterator(__next_pointer __node, size_t __bucket, - size_t __bucket_count) _NOEXCEPT - : __node_(__node), - __bucket_(__bucket), - __bucket_count_(__bucket_count) - { - if (__node_ != nullptr) - __node_ = __node_->__next_; - } -#endif template <class, class, class, class> friend class __hash_table; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator; @@ -664,12 +646,12 @@ public: __bucket_(__x.__bucket_), __bucket_count_(__x.__bucket_count_) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); #endif } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator(const __hash_const_local_iterator& __i) : __node_(__i.__node_), @@ -697,7 +679,7 @@ public: } return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -741,7 +723,6 @@ public: {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -749,22 +730,13 @@ private: __bucket_(__bucket), __bucket_count_(__bucket_count) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); +#endif if (__node_ != nullptr) __node_ = __node_->__next_; } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket, - size_t __bucket_count) _NOEXCEPT - : __node_(__node_ptr), - __bucket_(__bucket), - __bucket_count_(__bucket_count) - { - if (__node_ != nullptr) - __node_ = __node_->__next_; - } -#endif template <class, class, class, class> friend class __hash_table; template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; }; @@ -1286,11 +1258,7 @@ public: { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); -#else - return local_iterator(__bucket_list_[__n], __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1299,11 +1267,7 @@ public: { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return local_iterator(nullptr, __n, bucket_count(), this); -#else - return local_iterator(nullptr, __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1312,11 +1276,7 @@ public: { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); -#else - return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1325,21 +1285,17 @@ public: { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return const_local_iterator(nullptr, __n, bucket_count(), this); -#else - return const_local_iterator(nullptr, __n, bucket_count()); -#endif } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: void __rehash(size_type __n); @@ -1561,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) while (__np != nullptr) { __next_pointer __next = __np->__next_; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { @@ -1772,11 +1728,7 @@ inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__p1_.first().__next_, this); -#else - return iterator(__p1_.first().__next_); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1784,11 +1736,7 @@ inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(nullptr, this); -#else - return iterator(nullptr); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1796,11 +1744,7 @@ inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__p1_.first().__next_, this); -#else - return const_iterator(__p1_.first().__next_); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1808,11 +1752,7 @@ inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(nullptr, this); -#else - return const_iterator(nullptr); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -1917,11 +1857,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ __existing_node = __nd->__ptr(); __inserted = true; } -#if _LIBCPP_DEBUG_LEVEL == 2 return pair<iterator, bool>(iterator(__existing_node, this), __inserted); -#else - return pair<iterator, bool>(iterator(__existing_node), __inserted); -#endif } // Prepare the container for an insertion of the value __cp_val with the hash @@ -2015,11 +1951,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); __node_insert_multi_perform(__cp, __pn); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__cp->__ptr(), this); -#else - return iterator(__cp->__ptr()); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -2048,11 +1980,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( __cp->__next_ = __np; __pp->__next_ = static_cast<__next_pointer>(__cp); ++size(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(static_cast<__next_pointer>(__cp), this); -#else - return iterator(static_cast<__next_pointer>(__cp)); -#endif } return __node_insert_multi(__cp); } @@ -2118,11 +2046,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __inserted = true; } __done: -#if _LIBCPP_DEBUG_LEVEL == 2 return pair<iterator, bool>(iterator(__nd, this), __inserted); -#else - return pair<iterator, bool>(iterator(__nd), __inserted); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -2393,11 +2317,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nd, this); -#else - return iterator(__nd); -#endif } } } @@ -2424,11 +2344,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__nd, this); -#else - return const_iterator(__nd); -#endif } } @@ -2481,11 +2397,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) " referring to this container"); _LIBCPP_ASSERT(__p != end(), "unordered container erase(iterator) called with a non-dereferenceable iterator"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__np, this); -#else - iterator __r(__np); -#endif ++__r; remove(__p); return __r; @@ -2508,11 +2420,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, erase(__p); } __next_pointer __np = __last.__node_; -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator (__np, this); -#else - return iterator (__np); -#endif } template <class _Tp, class _Hash, class _Equal, class _Alloc> @@ -2579,7 +2487,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT __pn->__next_ = __cn->__next_; __cn->__next_ = nullptr; --size(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __dp = __c->end_; __dp != __c->beg_; ) { @@ -2762,7 +2670,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, __x.swap(__y); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template <class _Tp, class _Hash, class _Equal, class _Alloc> bool @@ -2792,7 +2700,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, return false; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/istream_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/istream_iterator.h index 9ee0a989b8..a056961c10 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/istream_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/istream_iterator.h @@ -15,6 +15,7 @@ #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> +#include <cstddef> #include <iosfwd> // for forward declarations of char_traits and basic_istream #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h index 6ce5595add..c3a5b7e0dd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/iterator_traits.h @@ -105,15 +105,14 @@ template <class _Tp> struct __has_iterator_typedefs { private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename __void_t<typename _Up::iterator_category>::type* = 0, - typename __void_t<typename _Up::difference_type>::type* = 0, - typename __void_t<typename _Up::value_type>::type* = 0, - typename __void_t<typename _Up::reference>::type* = 0, - typename __void_t<typename _Up::pointer>::type* = 0); + template <class _Up> static false_type __test(...); + template <class _Up> static true_type __test(typename __void_t<typename _Up::iterator_category>::type* = 0, + typename __void_t<typename _Up::difference_type>::type* = 0, + typename __void_t<typename _Up::value_type>::type* = 0, + typename __void_t<typename _Up::reference>::type* = 0, + typename __void_t<typename _Up::pointer>::type* = 0); public: - static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1; + static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value; }; @@ -121,22 +120,20 @@ template <class _Tp> struct __has_iterator_category { private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename _Up::iterator_category* = nullptr); + template <class _Up> static false_type __test(...); + template <class _Up> static true_type __test(typename _Up::iterator_category* = nullptr); public: - static const bool value = sizeof(__test<_Tp>(nullptr)) == 1; + static const bool value = decltype(__test<_Tp>(nullptr))::value; }; template <class _Tp> struct __has_iterator_concept { private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename _Up::iterator_concept* = nullptr); + template <class _Up> static false_type __test(...); + template <class _Up> static true_type __test(typename _Up::iterator_concept* = nullptr); public: - static const bool value = sizeof(__test<_Tp>(nullptr)) == 1; + static const bool value = decltype(__test<_Tp>(nullptr))::value; }; #if _LIBCPP_STD_VER > 17 @@ -469,27 +466,28 @@ template <class _Up> struct __is_cpp17_contiguous_iterator<_Up*> : true_type {}; +template <class _Iter> +class __wrap_iter; + template <class _Tp> struct __is_exactly_cpp17_input_iterator : public integral_constant<bool, __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; -#if _LIBCPP_STD_VER >= 17 template<class _InputIterator> using __iter_value_type = typename iterator_traits<_InputIterator>::value_type; template<class _InputIterator> -using __iter_key_type = remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>; +using __iter_key_type = typename remove_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type; template<class _InputIterator> using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type; template<class _InputIterator> using __iter_to_alloc_type = pair< - add_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>, + typename add_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type, typename iterator_traits<_InputIterator>::value_type::second_type>; -#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostream_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostream_iterator.h index f6601b23d6..76ae461493 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostream_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostream_iterator.h @@ -14,6 +14,7 @@ #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> +#include <cstddef> #include <iosfwd> // for forward declarations of char_traits and basic_ostream #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h index 16ddb6525a..6da7598ed2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/ostreambuf_iterator.h @@ -13,6 +13,7 @@ #include <__config> #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> +#include <cstddef> #include <iosfwd> // for forward declaration of basic_streambuf #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h index 69e5ee15aa..f780048754 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h @@ -50,12 +50,12 @@ public: typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT : __i(__u.base()) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__iterator_copy(this, _VSTD::addressof(__u)); #endif } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(const __wrap_iter& __x) : __i(__x.base()) @@ -135,17 +135,15 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit __wrap_iter(const void* __p, iterator_type __x) : __i(__x) + explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x) { + (void)__p; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_ic(this, __p); - } -#else - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} #endif + } template <class _Up> friend class __wrap_iter; template <class _CharT, class _Traits, class _Alloc> friend class basic_string; diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale index 1e4cb55375..9b973cf5c3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale +++ b/contrib/libs/cxxsupp/libcxx/include/__locale @@ -343,9 +343,9 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const return static_cast<long>(__h); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>; #endif // template <class CharT> class collate_byname; @@ -1503,15 +1503,15 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() } _LIBCPP_SUPPRESS_DEPRECATED_POP -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>; #endif -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20 +extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20 +extern template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20 #ifndef _LIBCPP_HAS_NO_CHAR8_T -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20 #endif template <size_t _Np> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h index 0316649e1f..2549e4be7d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/pointer_traits.h @@ -71,14 +71,12 @@ template <class _Tp, class _Up> struct __has_rebind { private: - struct __two {char __lx; char __lxx;}; - template <class _Xp> static __two __test(...); + template <class _Xp> static false_type __test(...); _LIBCPP_SUPPRESS_DEPRECATED_PUSH - // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. - template <class _Xp> static char __test(decltype(_VSTD::declval<typename _Xp::template rebind<_Up>*>()) = 0); + template <class _Xp> static true_type __test(typename _Xp::template rebind<_Up>* = 0); _LIBCPP_SUPPRESS_DEPRECATED_POP public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = decltype(__test<_Tp>(0))::value; }; template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h index f25f7b1a72..9b6594b888 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/raw_storage_iterator.h @@ -11,10 +11,11 @@ #define _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H #include <__config> +#include <__iterator/iterator.h> +#include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include <__utility/move.h> #include <cstddef> -#include <iterator> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h index 20147c5eb1..4a07a4a521 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/uses_allocator.h @@ -24,12 +24,10 @@ template <class _Tp> struct __has_allocator_type { private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - // Fix for MSVC which allows to reference private types. Wrap into declval to prevent that. - template <class _Up> static char __test(decltype(_VSTD::declval<typename _Up::allocator_type*>()) = 0); + template <class _Up> static false_type __test(...); + template <class _Up> static true_type __test(typename _Up::allocator_type* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = decltype(__test<_Tp>(0))::value; }; template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value> diff --git a/contrib/libs/cxxsupp/libcxx/include/__string b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h index 290ff74a51..82fe077cc7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string +++ b/contrib/libs/cxxsupp/libcxx/include/__string/char_traits.h @@ -1,4 +1,3 @@ -// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. @@ -7,26 +6,22 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___STRING -#define _LIBCPP___STRING +#ifndef _LIBCPP___STRING_CHAR_TRAITS_H +#define _LIBCPP___STRING_CHAR_TRAITS_H -#include <__algorithm/copy.h> -#include <__algorithm/copy_backward.h> #include <__algorithm/copy_n.h> #include <__algorithm/fill_n.h> #include <__algorithm/find_end.h> #include <__algorithm/find_first_of.h> #include <__algorithm/min.h> -#include <__assert> #include <__config> -#include <__debug> -#include <__functional/hash.h> // for __murmur2_or_cityhash +#include <__functional/hash.h> #include <__iterator/iterator_traits.h> -#include <cstdint> // for uint_least16_t -#include <cstdio> // for EOF -#include <cstring> // for memcpy -#include <iosfwd> // for streampos & friends -#include <type_traits> // for __libcpp_is_constant_evaluated +#include <cstdint> +#include <cstdio> +#include <cstring> +#include <iosfwd> +#include <type_traits> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # include <cwchar> // for wmemcpy @@ -39,132 +34,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -// The extern template ABI lists are kept outside of <string> to improve the -// readability of that header. We maintain 2 ABI lists: -// - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST -// - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST -// As the name implies, the ABI lists define the V1 (Stable) and unstable ABI. -// -// For unstable, we may explicitly remove function that are external in V1, -// and add (new) external functions to better control inlining and compiler -// optimization opportunities. -// -// For stable, the ABI list should rarely change, except for adding new -// functions supporting new c++ version / API changes. Typically entries -// must never be removed from the stable list. -#define _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::erase(size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(basic_string const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ - _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) - -#define _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init_copy_ctor_external(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<false>(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<true>(value_type const*, size_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__erase_external_with_move(size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ - _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ - _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ - _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ - _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) - -// Workaround for CUDA which doesn't like extern templates for variables. -#ifdef __CUDACC__ -#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) -#else -#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) \ - _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) -#endif - -// char_traits - template <class _CharT> struct _LIBCPP_TEMPLATE_VIS char_traits { @@ -293,40 +164,25 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) return __r; } -// constexpr versions of move/copy/assign. - template <class _CharT> static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __copy_constexpr(_CharT* __dest, const _CharT* __source, size_t __n) _NOEXCEPT +_CharT* __char_traits_move(_CharT* __dest, const _CharT* __source, size_t __n) _NOEXCEPT { - _LIBCPP_ASSERT(__libcpp_is_constant_evaluated(), "__copy_constexpr() should always be constant evaluated"); - _VSTD::copy_n(__source, __n, __dest); - return __dest; -} - -template <class _CharT> -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __move_constexpr(_CharT* __dest, const _CharT* __source, size_t __n) _NOEXCEPT -{ - _LIBCPP_ASSERT(__libcpp_is_constant_evaluated(), "__move_constexpr() should always be constant evaluated"); - if (__n == 0) +#ifdef _LIBCPP_COMPILER_GCC + if (__libcpp_is_constant_evaluated()) { + if (__n == 0) + return __dest; + _CharT* __allocation = new _CharT[__n]; + std::copy_n(__source, __n, __allocation); + std::copy_n(static_cast<const _CharT*>(__allocation), __n, __dest); + delete[] __allocation; return __dest; - _CharT* __allocation = new _CharT[__n]; - _VSTD::__copy_constexpr(__allocation, __source, __n); - _VSTD::__copy_constexpr(__dest, static_cast<const _CharT*>(__allocation), __n); - delete[] __allocation; + } +#endif + ::__builtin_memmove(__dest, __source, __n * sizeof(_CharT)); return __dest; } -template <class _CharT> -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT -{ - _LIBCPP_ASSERT(__libcpp_is_constant_evaluated(), "__assign_constexpr() should always be constant evaluated"); - _VSTD::fill_n(__s, __n, __a); - return __s; -} - // char_traits<char> template <> @@ -347,6 +203,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> static _LIBCPP_CONSTEXPR_AFTER_CXX14 int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; + static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 length(const char_type* __s) _NOEXCEPT { // GCC currently does not support __builtin_strlen during constant evaluation. // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 @@ -358,35 +215,30 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> return __i; } #endif - return __builtin_strlen(__s); + return __builtin_strlen(__s); } static _LIBCPP_CONSTEXPR_AFTER_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); - } + char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return std::__char_traits_move(__s1, __s2, __n); + } + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - } - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); - } + char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + if (!__libcpp_is_constant_evaluated()) + _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + std::copy_n(__s2, __n, __s1); + return __s1; + } + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); - } + char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { + std::fill_n(__s, __n, __a); + return __s; + } static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -469,30 +321,26 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> size_t length(const char_type* __s) _NOEXCEPT; static _LIBCPP_CONSTEXPR_AFTER_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : _VSTD::wmemmove(__s1, __s2, __n); - } + char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return std::__char_traits_move(__s1, __s2, __n); + } + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - } - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : _VSTD::wmemcpy(__s1, __s2, __n); - } + char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + if (!__libcpp_is_constant_evaluated()) + _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + std::copy_n(__s2, __n, __s1); + return __s1; + } + static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : _VSTD::wmemset(__s, __a, __n); - } + char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { + std::fill_n(__s, __n, __a); + return __s; + } + static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT @@ -593,31 +441,23 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); - } + char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return std::__char_traits_move(__s1, __s2, __n); + } static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - } - return __libcpp_is_constant_evaluated() - ? _VSTD::__copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); - } + char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + if (!__libcpp_is_constant_evaluated()) + _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + std::copy_n(__s2, __n, __s1); + return __s1; + } static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? _VSTD::__assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); - } + char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { + std::fill_n(__s, __n, __a); + return __s; + } static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -700,12 +540,25 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> size_t length(const char_type* __s) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return std::__char_traits_move(__s1, __s2, __n); + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + if (!__libcpp_is_constant_evaluated()) + _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + std::copy_n(__s2, __n, __s1); + return __s1; + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; + static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { + std::fill_n(__s, __n, __a); + return __s; + } static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -756,50 +609,6 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _ return nullptr; } -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - } - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - template <> struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> { @@ -822,12 +631,23 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> size_t length(const char_type* __s) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; + static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + return std::__char_traits_move(__s1, __s2, __n); + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; + static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { + std::copy_n(__s2, __n, __s1); + return __s1; + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; + static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT { + std::fill_n(__s, __n, __a); + return __s; + } static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT {return eq_int_type(__c, eof()) ? ~eof() : __c;} @@ -878,50 +698,6 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _ return nullptr; } -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - } - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - #endif // _LIBCPP_HAS_NO_UNICODE_CHARS // helper fns for basic_string and string_view @@ -1154,4 +930,4 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP___STRING +#endif // _LIBCPP___STRING_CHAR_TRAITS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__string/extern_template_lists.h b/contrib/libs/cxxsupp/libcxx/include/__string/extern_template_lists.h new file mode 100644 index 0000000000..57bedbe760 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__string/extern_template_lists.h @@ -0,0 +1,138 @@ +//===----------------------------------------------------------------------===// +// +// 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___STRING_EXTERN_TEMPLATE_LISTS_H +#define _LIBCPP___STRING_EXTERN_TEMPLATE_LISTS_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +// We maintain 2 ABI lists: +// - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST +// - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST +// As the name implies, the ABI lists define the V1 (Stable) and unstable ABI. +// +// For unstable, we may explicitly remove function that are external in V1, +// and add (new) external functions to better control inlining and compiler +// optimization opportunities. +// +// For stable, the ABI list should rarely change, except for adding new +// functions supporting new c++ version / API changes. Typically entries +// must never be removed from the stable list. +#define _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::erase(size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ + _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(basic_string const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ + _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) + +#define _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_Func, _CharType) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::operator=(value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init_copy_ctor_external(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS const _CharType& basic_string<_CharType>::at(size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_external(value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::reserve(size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_of(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by(size_type, size_type, size_type, size_type, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__grow_by_and_replace(size_type, size_type, size_type, size_type, size_type, size_type, value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<false>(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::__assign_no_alias<true>(value_type const*, size_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::push_back(value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::rfind(value_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__erase_external_with_move(size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(value_type const*) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*) const) \ + _Func(_LIBCPP_FUNC_VIS _CharType& basic_string<_CharType>::at(size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type const*, size_type, size_type) const _NOEXCEPT) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, basic_string const&, size_type, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS int basic_string<_CharType>::compare(size_type, size_type, value_type const*, size_type) const) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, basic_string const&, size_type, size_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::iterator basic_string<_CharType>::insert(basic_string::const_iterator, value_type)) \ + _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::resize(size_type, value_type)) \ + _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, basic_string const&, size_type, size_type)) \ + _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) + +// Workaround for CUDA which doesn't like extern templates for variables. +#ifdef __CUDACC__ +#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) +#else +#define _LIBCPP_STRING_EXTERN_TEMPLATE_VARIABLE_LIST(_Func, _CharType) \ + _Func(_LIBCPP_FUNC_VIS const basic_string<_CharType>::size_type basic_string<_CharType>::npos) +#endif + +#endif // _LIBCPP___STRING_EXTERN_TEMPLATE_LISTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__tree b/contrib/libs/cxxsupp/libcxx/include/__tree index c493ff9be0..e5dd1f4d45 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__tree +++ b/contrib/libs/cxxsupp/libcxx/include/__tree @@ -11,10 +11,14 @@ #define _LIBCPP___TREE #include <__algorithm/min.h> +#include <__assert> #include <__config> +#include <__debug> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/next.h> #include <__utility/forward.h> #include <__utility/swap.h> -#include <iterator> #include <limits> #include <memory> #include <stdexcept> @@ -29,12 +33,10 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(__GNUC__) && !defined(__clang__) // gcc.gnu.org/PR37804 template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS map; template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS multimap; template <class, class, class> class _LIBCPP_TEMPLATE_VIS set; template <class, class, class> class _LIBCPP_TEMPLATE_VIS multiset; -#endif template <class _Tp, class _Compare, class _Allocator> class __tree; template <class _Tp, class _NodePtr, class _DiffType> diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h new file mode 100644 index 0000000000..65c603058f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/alignment_of.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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_ALIGNMENT_OF_H +#define _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H + +#include <__config> +#include <__type_traits/integral_constant.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_TEMPLATE_VIS alignment_of + : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/apply_cv.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/apply_cv.h new file mode 100644 index 0000000000..4a5aab48a7 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/apply_cv.h @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// 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_APPLY_CV_H +#define _LIBCPP___TYPE_TRAITS_APPLY_CV_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_volatile.h> +#include <__type_traits/remove_reference.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, + bool = is_volatile<typename remove_reference<_Tp>::type>::value> +struct __apply_cv +{ + typedef _LIBCPP_NODEBUG _Up type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp, _Up, true, false> +{ + typedef _LIBCPP_NODEBUG const _Up type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp, _Up, false, true> +{ + typedef volatile _Up type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp, _Up, true, true> +{ + typedef const volatile _Up type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp&, _Up, false, false> +{ + typedef _Up& type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp&, _Up, true, false> +{ + typedef const _Up& type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp&, _Up, false, true> +{ + typedef volatile _Up& type; +}; + +template <class _Tp, class _Up> +struct __apply_cv<_Tp&, _Up, true, true> +{ + typedef const volatile _Up& type; +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_APPLY_CV_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h index ef182a9ed6..39852c4480 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h @@ -17,13 +17,32 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <bool> +struct _IfImpl; + +template <> +struct _IfImpl<true> { + template <class _IfRes, class _ElseRes> + using _Select _LIBCPP_NODEBUG = _IfRes; +}; + +template <> +struct _IfImpl<false> { + template <class _IfRes, class _ElseRes> + using _Select _LIBCPP_NODEBUG = _ElseRes; +}; + +template <bool _Cond, class _IfRes, class _ElseRes> +using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>; + template <bool _Bp, class _If, class _Then> struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;}; template <class _If, class _Then> struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;}; #if _LIBCPP_STD_VER > 11 -template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; +template <bool _Bp, class _IfRes, class _ElseRes> +using conditional_t = typename conditional<_Bp, _IfRes, _ElseRes>::type; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/conjunction.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conjunction.h new file mode 100644 index 0000000000..45fe5cdca3 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conjunction.h @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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_CONJUNCTION_H +#define _LIBCPP___TYPE_TRAITS_CONJUNCTION_H + +#include <__config> +#include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _Arg, class... _Args> +struct __conjunction_impl { + using type = conditional_t<!bool(_Arg::value), _Arg, typename __conjunction_impl<_Args...>::type>; +}; + +template <class _Arg> +struct __conjunction_impl<_Arg> { + using type = _Arg; +}; + +template <class... _Args> +struct conjunction : __conjunction_impl<true_type, _Args...>::type {}; + +template<class... _Args> +inline constexpr bool conjunction_v = conjunction<_Args...>::value; + +#endif // _LIBCPP_STD_VER > 14 + +template <class...> +using __expand_to_true = true_type; + +template <class... _Pred> +__expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int); + +template <class...> +false_type __and_helper(...); + +template <class... _Pred> +using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0)); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_CONJUNCTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/disjunction.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/disjunction.h new file mode 100644 index 0000000000..6c6d1a8f21 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/disjunction.h @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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_DISJUNCTION_H +#define _LIBCPP___TYPE_TRAITS_DISJUNCTION_H + +#include <__config> +#include <__type_traits/conditional.h> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <bool> +struct _OrImpl; + +template <> +struct _OrImpl<true> { + template <class _Res, class _First, class... _Rest> + using _Result _LIBCPP_NODEBUG = + typename _OrImpl<!bool(_First::value) && sizeof...(_Rest) != 0>::template _Result<_First, _Rest...>; +}; + +template <> +struct _OrImpl<false> { + template <class _Res, class...> + using _Result = _Res; +}; + +template <class... _Args> +using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>; + +#if _LIBCPP_STD_VER > 14 + +template <class... _Args> +struct disjunction : _Or<_Args...> {}; + +template <class... _Args> +inline constexpr bool disjunction_v = _Or<_Args...>::value; + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_DISJUNCTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_unique_object_representation.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_unique_object_representation.h new file mode 100644 index 0000000000..d6f75c9ce5 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_unique_object_representation.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_HAS_UNIQUE_OBJECT_REPRESENTATION_H +#define _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_all_extents.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations + : public integral_constant<bool, + __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {}; + +template <class _Tp> +inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_virtual_destructor.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_virtual_destructor.h new file mode 100644 index 0000000000..3357437363 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/has_virtual_destructor.h @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// 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_HAS_VIRTUAL_DESTRUCTOR_H +#define _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_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_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor + : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor + : public false_type {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h index 0480118b37..c74b3284f7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h @@ -23,7 +23,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract #if _LIBCPP_STD_VER > 14 template <class _Tp> -inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; +inline constexpr bool is_abstract_v = __is_abstract(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h index f32aec8ac5..ea9de84f96 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h @@ -24,7 +24,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {}; template <class _Tp> -inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; +inline constexpr bool is_aggregate_v = __is_aggregate(_Tp); #endif // _LIBCPP_STD_VER > 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_assignable.h new file mode 100644 index 0000000000..d85c1a4c85 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_assignable.h @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_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 + +template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; + +#if __has_keyword(__is_assignable) && !defined(__CUDACC__) + +template<class _Tp, class _Up> +struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Arg> +inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); +#endif + +#else // __has_keyword(__is_assignable) + +template <class _Tp, class _Arg> +typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type +__is_assignable_test(int); + +template <class, class> +false_type __is_assignable_test(...); + + +template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> +struct __is_assignable_imp + : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; + +template <class _Tp, class _Arg> +struct __is_assignable_imp<_Tp, _Arg, true> + : public false_type +{ +}; + +template <class _Tp, class _Arg> +struct is_assignable + : public __is_assignable_imp<_Tp, _Arg> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Arg> +inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; +#endif + +#endif // __has_keyword(__is_assignable) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H 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 b944a65d28..0e6dec0b5e 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 @@ -24,7 +24,7 @@ struct _LIBCPP_TEMPLATE_VIS is_base_of #if _LIBCPP_STD_VER > 14 template <class _Bp, class _Dp> -inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value; +inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h index 523dc493e8..cddaeae6e8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h @@ -20,27 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant<bool, __is_class(_Tp)> {}; -#else - -namespace __is_class_imp -{ -template <class _Tp> char __test(int _Tp::*); -template <class _Tp> __two __test(...); -} - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class - : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; - -#endif - #if _LIBCPP_STD_VER > 14 template <class _Tp> -inline constexpr bool is_class_v = is_class<_Tp>::value; +inline constexpr bool is_class_v = __is_class(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h index a53aa5c8f1..bf163129b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h @@ -19,8 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// >= 11 because in C++03 nullptr isn't actually nullptr -#if __has_keyword(__is_compound) && !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) +#if __has_keyword(__is_compound) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constant_evaluated.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constant_evaluated.h new file mode 100644 index 0000000000..ea77ae6482 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constant_evaluated.h @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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_CONSTANT_EVALUATED_H +#define _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED +#if _LIBCPP_STD_VER > 17 +_LIBCPP_INLINE_VISIBILITY +inline constexpr bool is_constant_evaluated() noexcept { + return __builtin_is_constant_evaluated(); +} +#endif + +inline _LIBCPP_CONSTEXPR +bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } +#else +inline _LIBCPP_CONSTEXPR +bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; } +#endif // !_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constructible.h new file mode 100644 index 0000000000..9a96c3df13 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_constructible.h @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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_IS_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_IS_CONSTRUCTIBLE_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 + +template <class _Tp, class ..._Args> +struct _LIBCPP_TEMPLATE_VIS is_constructible + : public integral_constant<bool, __is_constructible(_Tp, _Args...)> +{ }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class ..._Args> +inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_IS_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_assignable.h new file mode 100644 index 0000000000..e46b124945 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_assignable.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_COPY_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable + : public is_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_constructible.h new file mode 100644 index 0000000000..18dc27f2ef --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_copy_constructible.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_COPY_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_copy_constructible + : public is_constructible<_Tp, + typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_core_convertible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_core_convertible.h new file mode 100644 index 0000000000..1ce4079130 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_core_convertible.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_CORE_CONVERTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_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 + +// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed. +// We can't test for that, but we can test implicit convertibility by passing it +// to a function. Notice that __is_core_convertible<void,void> is false, +// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later. + +template <class _Tp, class _Up, class = void> +struct __is_core_convertible : public false_type {}; + +template <class _Tp, class _Up> +struct __is_core_convertible<_Tp, _Up, decltype( + static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() ) +)> : public true_type {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_default_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_default_constructible.h new file mode 100644 index 0000000000..a6368413d6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_default_constructible.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_DEFAULT_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_DEFAULT_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_default_constructible + : public is_constructible<_Tp> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_DEFAULT_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_destructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_destructible.h new file mode 100644 index 0000000000..d8c1fd96c9 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_destructible.h @@ -0,0 +1,102 @@ +//===----------------------------------------------------------------------===// +// +// 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_DESTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_DESTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_all_extents.h> +#include <__utility/declval.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_keyword(__is_destructible) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_destructible_v = __is_destructible(_Tp); +#endif + +#else // __has_keyword(__is_destructible) + +// if it's a reference, return true +// if it's a function, return false +// if it's void, return false +// if it's an array of unknown bound, return false +// Otherwise, return "declval<_Up&>().~_Up()" is well-formed +// where _Up is remove_all_extents<_Tp>::type + +template <class> +struct __is_destructible_apply { typedef int type; }; + +template <typename _Tp> +struct __is_destructor_wellformed { + template <typename _Tp1> + static true_type __test ( + typename __is_destructible_apply<decltype(declval<_Tp1&>().~_Tp1())>::type + ); + + template <typename _Tp1> + static false_type __test (...); + + static const bool value = decltype(__test<_Tp>(12))::value; +}; + +template <class _Tp, bool> +struct __destructible_imp; + +template <class _Tp> +struct __destructible_imp<_Tp, false> + : public integral_constant<bool, + __is_destructor_wellformed<typename remove_all_extents<_Tp>::type>::value> {}; + +template <class _Tp> +struct __destructible_imp<_Tp, true> + : public true_type {}; + +template <class _Tp, bool> +struct __destructible_false; + +template <class _Tp> +struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, is_reference<_Tp>::value> {}; + +template <class _Tp> +struct __destructible_false<_Tp, true> : public false_type {}; + +template <class _Tp> +struct is_destructible + : public __destructible_false<_Tp, is_function<_Tp>::value> {}; + +template <class _Tp> +struct is_destructible<_Tp[]> + : public false_type {}; + +template <> +struct is_destructible<void> + : public false_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; +#endif + +#endif // __has_keyword(__is_destructible) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_DESTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.h index e81c6f7e2f..042b4e6807 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.h @@ -18,38 +18,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_empty) || defined(_LIBCPP_COMPILER_GCC) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_empty : public integral_constant<bool, __is_empty(_Tp)> {}; -#else // __has_feature(is_empty) - -template <class _Tp> -struct __is_empty1 - : public _Tp -{ - double __lx; -}; - -struct __is_empty2 -{ - double __lx; -}; - -template <class _Tp, bool = is_class<_Tp>::value> -struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; - -template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_empty : public __libcpp_empty<_Tp> {}; - -#endif // __has_feature(is_empty) - #if _LIBCPP_STD_VER > 14 template <class _Tp> -inline constexpr bool is_empty_v = is_empty<_Tp>::value; +inline constexpr bool is_empty_v = __is_empty(_Tp); #endif _LIBCPP_END_NAMESPACE_STD 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 ac160da84e..bf6921c88c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; @@ -29,27 +27,6 @@ template <class _Tp> inline constexpr bool is_enum_v = __is_enum(_Tp); #endif -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum - : public integral_constant<bool, !is_void<_Tp>::value && - !is_integral<_Tp>::value && - !is_floating_point<_Tp>::value && - !is_array<_Tp>::value && - !is_pointer<_Tp>::value && - !is_reference<_Tp>::value && - !is_member_pointer<_Tp>::value && - !is_union<_Tp>::value && - !is_class<_Tp>::value && - !is_function<_Tp>::value > {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_enum_v = is_enum<_Tp>::value; -#endif - -#endif // __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_ENUM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.h index f2d9b5b3c8..74ced23a14 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.h @@ -28,7 +28,7 @@ is_final : public integral_constant<bool, __is_final(_Tp)> {}; #if _LIBCPP_STD_VER > 14 template <class _Tp> -inline constexpr bool is_final_v = is_final<_Tp>::value; +inline constexpr bool is_final_v = __is_final(_Tp); #endif _LIBCPP_END_NAMESPACE_STD 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 b5e63e4c37..0012f8fc28 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h @@ -20,15 +20,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function - : public _BoolConstant< -#if defined(__clang__) && !defined(__CUDACC__) - __is_function(_Tp) +#if __has_keyword(__is_function) && !defined(__CUDACC__) + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant<bool, __is_function(_Tp)> {}; + #else - !(is_reference<_Tp>::value || is_const<const _Tp>::value) -#endif - > {}; +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_function + : public integral_constant<bool, !(is_reference<_Tp>::value || is_const<const _Tp>::value)> {}; + +#endif // __has_keyword(__is_function) #if _LIBCPP_STD_VER > 14 template <class _Tp> 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 8590e9f82c..cdfa315cb2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h @@ -20,11 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// Before Clang 10, __is_fundamental didn't work for nullptr_t. -// In C++03 nullptr_t is library-provided but must still count as "fundamental." -#if __has_keyword(__is_fundamental) && \ - !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1000) && \ - !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) +#if __has_keyword(__is_fundamental) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_literal_type.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_literal_type.h new file mode 100644 index 0000000000..df525ecee2 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_literal_type.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_LITERAL_TYPE +#define _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE + +#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 _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type + : public integral_constant<bool, __is_literal_type(_Tp)> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; +#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_assignable.h new file mode 100644 index 0000000000..1e8aa23bea --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_assignable.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_MOVE_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable + : public is_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_rvalue_reference<_Tp>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_constructible.h new file mode 100644 index 0000000000..228cee7eff --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_move_constructible.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_MOVE_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_MOVE_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_move_constructible + : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MOVE_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_assignable.h new file mode 100644 index 0000000000..df455631b3 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_assignable.h @@ -0,0 +1,59 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#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_keyword(__is_nothrow_assignable) && !defined(__CUDACC__) + +template <class _Tp, class _Arg> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable + : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; + +#else + +template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; + +template <class _Tp, class _Arg> +struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> + : public false_type +{ +}; + +template <class _Tp, class _Arg> +struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> + : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Arg>()) > +{ +}; + +template <class _Tp, class _Arg> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable + : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> +{ +}; + +#endif // _LIBCPP_HAS_NO_NOEXCEPT + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Arg> +inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_ASSIGNABLE_H 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 new file mode 100644 index 0000000000..97f6c933fe --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_constructible.h @@ -0,0 +1,75 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__utility/declval.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_keyword(__is_nothrow_constructible) && !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(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(_VSTD::__implicit_conversion_to<_Tp>(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 // _LIBCPP_HAS_NO_NOEXCEPT + + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class ..._Args> +inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_assignable.h new file mode 100644 index 0000000000..8c4b8fd162 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_assignable.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_COPY_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_COPY_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable + : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_COPY_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_constructible.h new file mode 100644 index 0000000000..966df860e4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_copy_constructible.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_COPY_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_COPY_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible + : public is_nothrow_constructible<_Tp, + typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_COPY_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_default_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_default_constructible.h new file mode 100644 index 0000000000..addf359ec3 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_default_constructible.h @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_DEFAULT_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible + : public is_nothrow_constructible<_Tp> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE_H 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 new file mode 100644 index 0000000000..4763ae8408 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_destructible.h @@ -0,0 +1,90 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_DESTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_destructible.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/is_scalar.h> +#include <__type_traits/remove_all_extents.h> +#include <__utility/declval.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_CXX03_LANG) + +template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; + +template <class _Tp> +struct __libcpp_is_nothrow_destructible<false, _Tp> + : public false_type +{ +}; + +template <class _Tp> +struct __libcpp_is_nothrow_destructible<true, _Tp> + : public integral_constant<bool, noexcept(declval<_Tp>().~_Tp()) > +{ +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible + : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> +{ +}; + +template <class _Tp, size_t _Ns> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[_Ns]> + : public is_nothrow_destructible<_Tp> +{ +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&> + : public true_type +{ +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> + : public true_type +{ +}; + +#else + +template <class _Tp> struct __libcpp_nothrow_destructor + : public integral_constant<bool, is_scalar<_Tp>::value || + is_reference<_Tp>::value> {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible + : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> + : public false_type {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_assignable.h new file mode 100644 index 0000000000..44cea1f9cd --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_assignable.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_MOVE_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_MOVE_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable + : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_rvalue_reference<_Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_MOVE_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_constructible.h new file mode 100644 index 0000000000..e3b1171a48 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_move_constructible.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_MOVE_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_MOVE_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible + : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_MOVE_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pod.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pod.h new file mode 100644 index 0000000000..4317182f89 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pod.h @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// 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_POD_H +#define _LIBCPP___TYPE_TRAITS_IS_POD_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_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod + : public integral_constant<bool, __is_pod(_Tp)> {}; + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod + : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && + is_trivially_copy_constructible<_Tp>::value && + is_trivially_copy_assignable<_Tp>::value && + is_trivially_destructible<_Tp>::value> {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_pod_v = is_pod<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_POD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h index 585d5035b4..e1c6c2060b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h @@ -19,10 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// Before AppleClang 12.0.5, __is_pointer didn't work for Objective-C types. -#if __has_keyword(__is_pointer) && \ - !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1205) && \ - !defined(__CUDACC__) +#if __has_keyword(__is_pointer) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_polymorphic.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_polymorphic.h new file mode 100644 index 0000000000..96da48abee --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_polymorphic.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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_POLYMORPHIC_H +#define _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_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 + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_polymorphic + : public integral_constant<bool, __is_polymorphic(_Tp)> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp); +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.h index 6d98a3db99..b97631cc39 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.h @@ -19,16 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -struct __two {char __lx[2];}; - struct __is_referenceable_impl { template <class _Tp> static _Tp& __test(int); - template <class _Tp> static __two __test(...); + template <class _Tp> static false_type __test(...); }; template <class _Tp> struct __is_referenceable : integral_constant<bool, - _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {}; + _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), false_type>::value> {}; _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 c37ef5899f..a02dfb853a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h @@ -22,8 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// In C++03 nullptr_t is library-provided but must still count as "scalar." -#if __has_keyword(__is_scalar) && !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) +#if __has_keyword(__is_scalar) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; 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 new file mode 100644 index 0000000000..85a4128133 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scoped_enum.h @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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 > 20 +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 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_standard_layout.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_standard_layout.h new file mode 100644 index 0000000000..375d08721e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_standard_layout.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_STANDARD_LAYOUT_H +#define _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_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 + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout +#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) + : public integral_constant<bool, __is_standard_layout(_Tp)> +#else + : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> +#endif + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivial.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivial.h new file mode 100644 index 0000000000..011963c3d0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivial.h @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIAL_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_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 + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial +#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) + : public integral_constant<bool, __is_trivial(_Tp)> +#else + : integral_constant<bool, is_trivially_copyable<_Tp>::value && + is_trivially_default_constructible<_Tp>::value> +#endif + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_assignable.h new file mode 100644 index 0000000000..01540f959e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_assignable.h @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_ASSIGNABLE_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 + +template <class _Tp, class _Arg> +struct is_trivially_assignable + : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> +{ }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Arg> +inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_constructible.h new file mode 100644 index 0000000000..92ea58005f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_constructible.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_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 + +template <class _Tp, class... _Args> +struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible + : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> +{ +}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class... _Args> +inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_assignable.h new file mode 100644 index 0000000000..066d763884 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_assignable.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_COPY_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPY_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_trivially_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable + : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPY_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_constructible.h new file mode 100644 index 0000000000..e0c054d775 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copy_constructible.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_COPY_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPY_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_trivially_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible + : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPY_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copyable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copyable.h new file mode 100644 index 0000000000..3b76652172 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_copyable.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_COPYABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_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 + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable + : public integral_constant<bool, __is_trivially_copyable(_Tp)> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_default_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_default_constructible.h new file mode 100644 index 0000000000..822fa9c910 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_default_constructible.h @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_DEFAULT_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_trivially_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible + : public is_trivially_constructible<_Tp> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_destructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_destructible.h new file mode 100644 index 0000000000..5c7086bba1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_destructible.h @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_DESTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_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_keyword(__is_trivially_destructible) && !defined(__CUDACC__) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible + : public integral_constant<bool, __is_trivially_destructible(_Tp)> {}; + +#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible + : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; + +#else + +template <class _Tp> struct __libcpp_trivial_destructor + : public integral_constant<bool, is_scalar<_Tp>::value || + is_reference<_Tp>::value> {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible + : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]> + : public false_type {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_assignable.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_assignable.h new file mode 100644 index 0000000000..fc033a40de --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_assignable.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_MOVE_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_MOVE_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_trivially_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable + : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, + typename add_rvalue_reference<_Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_MOVE_ASSIGNABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_constructible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_constructible.h new file mode 100644 index 0000000000..be005cc264 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_trivially_move_constructible.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_TRIVIALLY_MOVE_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_trivially_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible + : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> + {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.h index d02931fc01..3e8cffe034 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.h @@ -19,22 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC) - template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant<bool, __is_union(_Tp)> {}; -#else - -template <class _Tp> struct __libcpp_union : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union - : public __libcpp_union<typename remove_cv<_Tp>::type> {}; - -#endif - #if _LIBCPP_STD_VER > 14 template <class _Tp> -inline constexpr bool is_union_v = is_union<_Tp>::value; +inline constexpr bool is_union_v = __is_union(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h index 69baa17b0a..30801b1625 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h @@ -20,11 +20,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// Before Clang 13, __is_unsigned returned true for enums with signed underlying type. -// No currently-released version of AppleClang contains the fixed intrinsic. -#if __has_keyword(__is_unsigned) && \ - !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1300) && \ - !defined(_LIBCPP_APPLE_CLANG_VER) && !defined(__CUDACC__) +// Before AppleClang 14, __is_unsigned returned true for enums with signed underlying type. +#if __has_keyword(__is_unsigned) && !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1400) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/negation.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/negation.h new file mode 100644 index 0000000000..92f205fb83 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/negation.h @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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_NEGATION_H +#define _LIBCPP___TYPE_TRAITS_NEGATION_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 + +template <class _Pred> +struct _Not : _BoolConstant<!_Pred::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +struct negation : _Not<_Tp> {}; +template<class _Tp> +inline constexpr bool negation_v = negation<_Tp>::value; +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_NEGATION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/underlying_type.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/underlying_type.h new file mode 100644 index 0000000000..1c8db64323 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/underlying_type.h @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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_UNDERLYING_TYPE_H +#define _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H + +#include <__config> +#include <__type_traits/is_enum.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl; + +template <class _Tp> +struct __underlying_type_impl<_Tp, false> {}; + +template <class _Tp> +struct __underlying_type_impl<_Tp, true> +{ + typedef __underlying_type(_Tp) type; +}; + +template <class _Tp> +struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/void_t.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/void_t.h new file mode 100644 index 0000000000..a71ab5e4b0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/void_t.h @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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_VOID_T_H +#define _LIBCPP___TYPE_TRAITS_VOID_T_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 +template <class...> using void_t = void; +#endif + +template <class> +struct __void_t { typedef void type; }; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_VOID_T_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h index 6ee1f818ba..03ca16d9f9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h @@ -11,7 +11,8 @@ #define _LIBCPP___UTILITY_FORWARD_H #include <__config> -#include <type_traits> +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__wrappers_config b/contrib/libs/cxxsupp/libcxx/include/__wrappers_config index 40a56485fb..a8c6226ad1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__wrappers_config +++ b/contrib/libs/cxxsupp/libcxx/include/__wrappers_config @@ -40,6 +40,7 @@ // should be removed in https://st.yandex-team.ru/IGNIETFERRO-1955 #define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS +// #define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION // should be removed in https://st.yandex-team.ru/IGNIETFERRO-1956 #define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index 4718451e2e..44ecb14a01 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -345,6 +345,85 @@ namespace ranges { indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t<R> + upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t<R> + lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, forward_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_iterator_t<R1> + ranges::find_first_of(R1&& r1, R2&& r2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_binary_predicate<projected<I, Proj>, + projected<I, Proj>> Pred = ranges::equal_to> + constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 + + template<forward_range R, class Proj = identity, + indirect_binary_predicate<projected<iterator_t<R>, Proj>, + projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> + constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> + requires indirectly_writable<I, const T2&> && + indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> + constexpr I + ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 + + template<input_range R, class T1, class T2, class Proj = identity> + requires indirectly_writable<iterator_t<R>, const T2&> && + indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> + constexpr borrowed_iterator_t<R> + ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_writable<I, const T&> + constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 + + template<input_range R, class T, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_writable<iterator_t<R>, const T&> + constexpr borrowed_iterator_t<R> + ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 + } constexpr bool // constexpr in C++20 @@ -989,7 +1068,7 @@ template <class BidirectionalIterator, class Compare> #include <cstddef> #include <cstring> #include <initializer_list> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <memory> #include <type_traits> #include <version> @@ -1061,8 +1140,10 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_adjacent_find.h> #include <__algorithm/ranges_all_of.h> #include <__algorithm/ranges_any_of.h> +#include <__algorithm/ranges_binary_search.h> #include <__algorithm/ranges_copy.h> #include <__algorithm/ranges_copy_backward.h> #include <__algorithm/ranges_copy_if.h> @@ -1073,6 +1154,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_fill.h> #include <__algorithm/ranges_fill_n.h> #include <__algorithm/ranges_find.h> +#include <__algorithm/ranges_find_first_of.h> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> #include <__algorithm/ranges_for_each.h> @@ -1080,6 +1162,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_is_partitioned.h> #include <__algorithm/ranges_is_sorted.h> #include <__algorithm/ranges_is_sorted_until.h> +#include <__algorithm/ranges_lower_bound.h> #include <__algorithm/ranges_max.h> #include <__algorithm/ranges_max_element.h> #include <__algorithm/ranges_min.h> @@ -1088,9 +1171,12 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_minmax_element.h> #include <__algorithm/ranges_mismatch.h> #include <__algorithm/ranges_none_of.h> +#include <__algorithm/ranges_replace.h> +#include <__algorithm/ranges_replace_if.h> #include <__algorithm/ranges_reverse.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> +#include <__algorithm/ranges_upper_bound.h> #include <__algorithm/remove.h> #include <__algorithm/remove_copy.h> #include <__algorithm/remove_copy_if.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/any b/contrib/libs/cxxsupp/libcxx/include/any index 308a49e810..991d887bf2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/any +++ b/contrib/libs/cxxsupp/libcxx/include/any @@ -88,6 +88,7 @@ namespace std { #include <__utility/move.h> #include <__utility/unreachable.h> #include <cstdlib> +#include <initializer_list> #include <memory> #include <type_traits> #include <typeinfo> diff --git a/contrib/libs/cxxsupp/libcxx/include/array b/contrib/libs/cxxsupp/libcxx/include/array index 786dc75746..4258853853 100644 --- a/contrib/libs/cxxsupp/libcxx/include/array +++ b/contrib/libs/cxxsupp/libcxx/include/array @@ -114,11 +114,13 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce #include <__algorithm/swap_ranges.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__iterator/reverse_iterator.h> #include <__tuple> #include <__utility/integer_sequence.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <iterator> +#include <compare> +#include <iterator> // TODO: Remove this include #include <stdexcept> #include <type_traits> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/bit b/contrib/libs/cxxsupp/libcxx/include/bit index b73c4b44c8..f830302fd5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bit +++ b/contrib/libs/cxxsupp/libcxx/include/bit @@ -65,6 +65,7 @@ namespace std { #include <__bit/bit_cast.h> #include <__bit/byteswap.h> #include <__bits> // __libcpp_clz +#include <__concepts/arithmetic.h> #include <__config> #include <limits> #include <type_traits> @@ -87,7 +88,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp __rotl(_Tp __t, unsigned int __cnt) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires an unsigned integer type"); @@ -98,7 +99,7 @@ _Tp __rotl(_Tp __t, unsigned int __cnt) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); @@ -109,7 +110,7 @@ _Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 int __countr_zero(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_zero requires an unsigned integer type"); @@ -136,7 +137,7 @@ int __countr_zero(_Tp __t) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 int __countl_zero(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type"); @@ -168,7 +169,7 @@ int __countl_zero(_Tp __t) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 int __countl_one(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_one requires an unsigned integer type"); @@ -178,7 +179,7 @@ int __countl_one(_Tp __t) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 int __countr_one(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countr_one requires an unsigned integer type"); @@ -188,7 +189,7 @@ int __countr_one(_Tp __t) _NOEXCEPT } template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 int __popcount(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__popcount requires an unsigned integer type"); @@ -212,7 +213,7 @@ int __popcount(_Tp __t) _NOEXCEPT // integral log base 2 template<class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 unsigned __bit_log2(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__bit_log2 requires an unsigned integer type"); @@ -220,7 +221,7 @@ unsigned __bit_log2(_Tp __t) _NOEXCEPT } template <class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __has_single_bit(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__has_single_bit requires an unsigned integer type"); @@ -229,103 +230,70 @@ bool __has_single_bit(_Tp __t) _NOEXCEPT #if _LIBCPP_STD_VER > 17 -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> -rotl(_Tp __t, unsigned int __cnt) noexcept -{ - return __rotl(__t, __cnt); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, unsigned int __cnt) noexcept { + return __rotl(__t, __cnt); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> -rotr(_Tp __t, unsigned int __cnt) noexcept -{ - return __rotr(__t, __cnt); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, unsigned int __cnt) noexcept { + return __rotr(__t, __cnt); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -countl_zero(_Tp __t) noexcept -{ - return __countl_zero(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int countl_zero(_Tp __t) noexcept { + return __countl_zero(__t); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -countl_one(_Tp __t) noexcept -{ - return __countl_one(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int countl_one(_Tp __t) noexcept { + return __countl_one(__t); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -countr_zero(_Tp __t) noexcept -{ - return __countr_zero(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) noexcept { + return __countr_zero(__t); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -countr_one(_Tp __t) noexcept -{ - return __countr_one(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int countr_one(_Tp __t) noexcept { + return __countr_one(__t); } -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -popcount(_Tp __t) noexcept -{ - return __popcount(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noexcept { + return __popcount(__t); } -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, bool> -has_single_bit(_Tp __t) noexcept -{ - return __has_single_bit(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept { + return __has_single_bit(__t); } -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> -bit_floor(_Tp __t) noexcept -{ - return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t); +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept { + return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t); } -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp> -bit_ceil(_Tp __t) noexcept -{ - if (__t < 2) return 1; - const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u)); - _LIBCPP_ASSERT(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); - - if constexpr (sizeof(_Tp) >= sizeof(unsigned)) - return _Tp{1} << __n; - else - { - const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits; - const unsigned __retVal = 1u << (__n + __extra); - return (_Tp) (__retVal >> __extra); - } +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noexcept { + if (__t < 2) + return 1; + const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u)); + _LIBCPP_ASSERT(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); + + if constexpr (sizeof(_Tp) >= sizeof(unsigned)) + return _Tp{1} << __n; + else { + const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits; + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp)(__retVal >> __extra); + } } -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int> -bit_width(_Tp __t) noexcept -{ - return __t == 0 ? 0 : __bit_log2(__t) + 1; +template <__libcpp_unsigned_integer _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr int bit_width(_Tp __t) noexcept { + return __t == 0 ? 0 : __bit_log2(__t) + 1; } enum class endian diff --git a/contrib/libs/cxxsupp/libcxx/include/bitset b/contrib/libs/cxxsupp/libcxx/include/bitset index f4d9a643f9..039aaedaf4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/bitset +++ b/contrib/libs/cxxsupp/libcxx/include/bitset @@ -116,6 +116,7 @@ template <size_t N> struct hash<std::bitset<N>>; #include <__assert> // all public C++ headers provide the assertion handler #include <__bit_reference> #include <__config> +#include <__functional/hash.h> #include <__functional/unary_function.h> #include <climits> #include <cstddef> diff --git a/contrib/libs/cxxsupp/libcxx/include/charconv b/contrib/libs/cxxsupp/libcxx/include/charconv index d5e485a367..ce2897cf7c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/charconv +++ b/contrib/libs/cxxsupp/libcxx/include/charconv @@ -82,6 +82,8 @@ namespace std { #include <__bits> #include <__charconv/chars_format.h> #include <__charconv/from_chars_result.h> +#include <__charconv/tables.h> +#include <__charconv/to_chars_base_10.h> #include <__charconv/to_chars_result.h> #include <__config> #include <__debug> @@ -105,46 +107,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_CXX03_LANG -namespace __itoa { -_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer) noexcept; -_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer) noexcept; -} // namespace __itoa - to_chars_result to_chars(char*, char*, bool, int = 10) = delete; from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete; namespace __itoa { -static constexpr uint64_t __pow10_64[] = { - UINT64_C(0), - UINT64_C(10), - UINT64_C(100), - UINT64_C(1000), - UINT64_C(10000), - UINT64_C(100000), - UINT64_C(1000000), - UINT64_C(10000000), - UINT64_C(100000000), - UINT64_C(1000000000), - UINT64_C(10000000000), - UINT64_C(100000000000), - UINT64_C(1000000000000), - UINT64_C(10000000000000), - UINT64_C(100000000000000), - UINT64_C(1000000000000000), - UINT64_C(10000000000000000), - UINT64_C(100000000000000000), - UINT64_C(1000000000000000000), - UINT64_C(10000000000000000000), -}; - -static constexpr uint32_t __pow10_32[] = { - UINT32_C(0), UINT32_C(10), UINT32_C(100), - UINT32_C(1000), UINT32_C(10000), UINT32_C(100000), - UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), - UINT32_C(1000000000), -}; template <typename _Tp, typename = void> struct _LIBCPP_HIDDEN __traits_base @@ -154,16 +122,15 @@ struct _LIBCPP_HIDDEN __traits_base static _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { auto __t = (64 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; - return __t - (__v < __pow10_64[__t]) + 1; + return __t - (__v < __table<>::__pow10_64[__t]) + 1; } - _LIBCPP_AVAILABILITY_TO_CHARS static _LIBCPP_HIDE_FROM_ABI char* __convert(_Tp __v, char* __p) { - return __u64toa(__v, __p); + return __itoa::__base_10_u64(__v, __p); } - static _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() { return __pow10_64; } + static _LIBCPP_HIDE_FROM_ABI decltype(__table<>::__pow10_64)& __pow() { return __table<>::__pow10_64; } }; template <typename _Tp> @@ -175,16 +142,15 @@ struct _LIBCPP_HIDDEN static _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { auto __t = (32 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; - return __t - (__v < __pow10_32[__t]) + 1; + return __t - (__v < __table<>::__pow10_32[__t]) + 1; } - _LIBCPP_AVAILABILITY_TO_CHARS static _LIBCPP_HIDE_FROM_ABI char* __convert(_Tp __v, char* __p) { - return __u32toa(__v, __p); + return __itoa::__base_10_u32(__v, __p); } - static _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() { return __pow10_32; } + static _LIBCPP_HIDE_FROM_ABI decltype(__table<>::__pow10_32)& __pow() { return __table<>::__pow10_32; } }; template <typename _Tp> @@ -275,7 +241,6 @@ __complement(_Tp __x) } template <typename _Tp> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result __to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) { @@ -290,7 +255,6 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) } template <typename _Tp> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) { @@ -304,7 +268,6 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) } template <typename _Tp> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, true_type) @@ -321,55 +284,6 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, namespace __itoa { -static constexpr char __base_2_lut[64] = { - '0', '0', '0', '0', - '0', '0', '0', '1', - '0', '0', '1', '0', - '0', '0', '1', '1', - '0', '1', '0', '0', - '0', '1', '0', '1', - '0', '1', '1', '0', - '0', '1', '1', '1', - '1', '0', '0', '0', - '1', '0', '0', '1', - '1', '0', '1', '0', - '1', '0', '1', '1', - '1', '1', '0', '0', - '1', '1', '0', '1', - '1', '1', '1', '0', - '1', '1', '1', '1' -}; - -static constexpr char __base_8_lut[128] = { - '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', - '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', - '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', - '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', - '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', - '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', - '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', - '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7' -}; - -static constexpr char __base_16_lut[512] = { - '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0', 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', - '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', - '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '2', 'a', '2', 'b', '2', 'c', '2', 'd', '2', 'e', '2', 'f', - '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', '3', 'a', '3', 'b', '3', 'c', '3', 'd', '3', 'e', '3', 'f', - '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '4', 'a', '4', 'b', '4', 'c', '4', 'd', '4', 'e', '4', 'f', - '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '5', 'a', '5', 'b', '5', 'c', '5', 'd', '5', 'e', '5', 'f', - '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', '6', 'a', '6', 'b', '6', 'c', '6', 'd', '6', 'e', '6', 'f', - '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '7', 'a', '7', 'b', '7', 'c', '7', 'd', '7', 'e', '7', 'f', - '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', '8', 'a', '8', 'b', '8', 'c', '8', 'd', '8', 'e', '8', 'f', - '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9', '9', 'a', '9', 'b', '9', 'c', '9', 'd', '9', 'e', '9', 'f', - 'a', '0', 'a', '1', 'a', '2', 'a', '3', 'a', '4', 'a', '5', 'a', '6', 'a', '7', 'a', '8', 'a', '9', 'a', 'a', 'a', 'b', 'a', 'c', 'a', 'd', 'a', 'e', 'a', 'f', - 'b', '0', 'b', '1', 'b', '2', 'b', '3', 'b', '4', 'b', '5', 'b', '6', 'b', '7', 'b', '8', 'b', '9', 'b', 'a', 'b', 'b', 'b', 'c', 'b', 'd', 'b', 'e', 'b', 'f', - 'c', '0', 'c', '1', 'c', '2', 'c', '3', 'c', '4', 'c', '5', 'c', '6', 'c', '7', 'c', '8', 'c', '9', 'c', 'a', 'c', 'b', 'c', 'c', 'c', 'd', 'c', 'e', 'c', 'f', - 'd', '0', 'd', '1', 'd', '2', 'd', '3', 'd', '4', 'd', '5', 'd', '6', 'd', '7', 'd', '8', 'd', '9', 'd', 'a', 'd', 'b', 'd', 'c', 'd', 'd', 'd', 'e', 'd', 'f', - 'e', '0', 'e', '1', 'e', '2', 'e', '3', 'e', '4', 'e', '5', 'e', '6', 'e', '7', 'e', '8', 'e', '9', 'e', 'a', 'e', 'b', 'e', 'c', 'e', 'd', 'e', 'e', 'e', 'f', - 'f', '0', 'f', '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c', 'f', 'd', 'f', 'e', 'f', 'f' -}; - template <unsigned _Base> struct _LIBCPP_HIDDEN __integral; @@ -397,7 +311,7 @@ struct _LIBCPP_HIDDEN __integral<2> { unsigned __c = __value % __divisor; __value /= __divisor; __p -= 4; - std::memcpy(__p, &__base_2_lut[4 * __c], 4); + std::memcpy(__p, &__table<>::__base_2_lut[4 * __c], 4); } do { unsigned __c = __value % 2; @@ -432,7 +346,7 @@ struct _LIBCPP_HIDDEN __integral<8> { unsigned __c = __value % __divisor; __value /= __divisor; __p -= 2; - std::memcpy(__p, &__base_8_lut[2 * __c], 2); + std::memcpy(__p, &__table<>::__base_8_lut[2 * __c], 2); } do { unsigned __c = __value % 8; @@ -468,7 +382,7 @@ struct _LIBCPP_HIDDEN __integral<16> { unsigned __c = __value % __divisor; __value /= __divisor; __p -= 2; - std::memcpy(__p, &__base_16_lut[2 * __c], 2); + std::memcpy(__p, &__table<>::__base_16_lut[2 * __c], 2); } if (__first != __last) do { @@ -511,7 +425,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value) { } template <typename _Tp> -_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_HIDE_FROM_ABI int +_LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) { _LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value."); @@ -538,7 +452,6 @@ __to_chars_integral_width(_Tp __value, unsigned __base) { } template <typename _Tp> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type) @@ -571,7 +484,6 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, } template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result to_chars(char* __first, char* __last, _Tp __value) { @@ -579,7 +491,6 @@ to_chars(char* __first, char* __last, _Tp __value) } template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -_LIBCPP_AVAILABILITY_TO_CHARS inline _LIBCPP_HIDE_FROM_ABI to_chars_result to_chars(char* __first, char* __last, _Tp __value, int __base) { diff --git a/contrib/libs/cxxsupp/libcxx/include/csignal b/contrib/libs/cxxsupp/libcxx/include/csignal index 81ca89091c..c1b58f818b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/csignal +++ b/contrib/libs/cxxsupp/libcxx/include/csignal @@ -41,7 +41,10 @@ int raise(int sig); #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <signal.h> + +#if __has_include(<signal.h>) +# include <signal.h> +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index 51ee2aee40..aee9141099 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -173,13 +173,16 @@ template <class T, class Allocator, class Predicate> #include <__config> #include <__format/enable_insertable.h> #include <__iterator/iterator_traits.h> +#include <__iterator/next.h> +#include <__iterator/prev.h> +#include <__iterator/reverse_iterator.h> #include <__split_buffer> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> #include <compare> #include <initializer_list> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <stdexcept> #include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index 98fa0b0346..b60a6aaa68 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -23,15 +23,26 @@ namespace std { using format_args = basic_format_args<format_context>; using wformat_args = basic_format_args<wformat_context>; + // [format.fmt.string], class template basic-format-string + template<class charT, class... Args> + struct basic-format-string; // exposition only + + template<class... Args> + using format-string = // exposition only + basic-format-string<char, type_identity_t<Args>...>; + template<class... Args> + using wformat-string = // exposition only + basic-format-string<wchar_t, type_identity_t<Args>...>; + // [format.functions], formatting functions template<class... Args> - string format(string_view fmt, const Args&... args); + string format(format-string<Args...> fmt, const Args&... args); template<class... Args> - wstring format(wstring_view fmt, const Args&... args); + wstring format(wformat-string<Args...> fmt, const Args&... args); template<class... Args> - string format(const locale& loc, string_view fmt, const Args&... args); + string format(const locale& loc, format-string<Args...> fmt, const Args&... args); template<class... Args> - wstring format(const locale& loc, wstring_view fmt, const Args&... args); + wstring format(const locale& loc, wformat-string<Args...> fmt, const Args&... args); string vformat(string_view fmt, format_args args); wstring vformat(wstring_view fmt, wformat_args args); @@ -39,13 +50,13 @@ namespace std { wstring vformat(const locale& loc, wstring_view fmt, wformat_args args); template<class Out, class... Args> - Out format_to(Out out, string_view fmt, const Args&... args); + Out format_to(Out out, format-string<Args...> fmt, const Args&... args); template<class Out, class... Args> - Out format_to(Out out, wstring_view fmt, const Args&... args); + Out format_to(Out out, wformat-string<Args...> fmt, const Args&... args); template<class Out, class... Args> - Out format_to(Out out, const locale& loc, string_view fmt, const Args&... args); + Out format_to(Out out, const locale& loc, format-string<Args...> fmt, const Args&... args); template<class Out, class... Args> - Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args); + Out format_to(Out out, const locale& loc, wformat-string<Args...> fmt, const Args&... args); template<class Out> Out vformat_to(Out out, string_view fmt, format_args args); @@ -64,27 +75,27 @@ namespace std { }; template<class Out, class... Args> format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n, - string_view fmt, const Args&... args); + format-string<Args...> fmt, const Args&... args); template<class Out, class... Args> format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n, - wstring_view fmt, const Args&... args); + wformat-string<Args...> fmt, const Args&... args); template<class Out, class... Args> format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n, - const locale& loc, string_view fmt, + const locale& loc, format-string<Args...> fmt, const Args&... args); template<class Out, class... Args> format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n, - const locale& loc, wstring_view fmt, + const locale& loc, wformat-string<Args...> fmt, const Args&... args); template<class... Args> - size_t formatted_size(string_view fmt, const Args&... args); + size_t formatted_size(format-string<Args...> fmt, const Args&... args); template<class... Args> - size_t formatted_size(wstring_view fmt, const Args&... args); + size_t formatted_size(wformat-string<Args...> fmt, const Args&... args); template<class... Args> - size_t formatted_size(const locale& loc, string_view fmt, const Args&... args); + size_t formatted_size(const locale& loc, format-string<Args...> fmt, const Args&... args); template<class... Args> - size_t formatted_size(const locale& loc, wstring_view fmt, const Args&... args); + size_t formatted_size(const locale& loc, wformat-string<Args...> fmt, const Args&... args); // [format.formatter], formatter template<class T, class charT = char> struct formatter; @@ -146,6 +157,7 @@ namespace std { #include <__format/formatter_pointer.h> #include <__format/formatter_string.h> #include <__format/parser_std_format_spec.h> +#include <__iterator/incrementable_traits.h> #include <__variant/monostate.h> #include <array> #include <concepts> @@ -202,8 +214,163 @@ _LIBCPP_HIDE_FROM_ABI auto make_wformat_args(const _Args&... __args) { namespace __format { +/// Helper class parse and handle argument. +/// +/// When parsing a handle which is not enabled the code is ill-formed. +/// This helper uses the parser of the appropriate formatter for the stored type. +template <class _CharT> +class _LIBCPP_TEMPLATE_VIS __compile_time_handle { +public: + _LIBCPP_HIDE_FROM_ABI + constexpr void __parse(basic_format_parse_context<_CharT>& __parse_ctx) const { __parse_(__parse_ctx); } + + template <class _Tp> + _LIBCPP_HIDE_FROM_ABI constexpr void __enable() { + __parse_ = [](basic_format_parse_context<_CharT>& __parse_ctx) { + formatter<_Tp, _CharT> __f; + __parse_ctx.advance_to(__f.parse(__parse_ctx)); + }; + } + + // Before calling __parse the proper handler needs to be set with __enable. + // The default handler isn't a core constant expression. + _LIBCPP_HIDE_FROM_ABI constexpr __compile_time_handle() + : __parse_([](basic_format_parse_context<_CharT>&) { __throw_format_error("Not a handle"); }) {} + +private: + void (*__parse_)(basic_format_parse_context<_CharT>&); +}; + +// Dummy format_context only providing the parts used during constant +// validation of the basic-format-string. +template <class _CharT> +struct _LIBCPP_TEMPLATE_VIS __compile_time_basic_format_context { +public: + using char_type = _CharT; + + _LIBCPP_HIDE_FROM_ABI constexpr explicit __compile_time_basic_format_context( + const __arg_t* __args, const __compile_time_handle<_CharT>* __handles, size_t __size) + : __args_(__args), __handles_(__handles), __size_(__size) {} + + // During the compile-time validation nothing needs to be written. + // Therefore all operations of this iterator are a NOP. + struct iterator { + _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator=(_CharT) { return *this; } + _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator*() { return *this; } + _LIBCPP_HIDE_FROM_ABI constexpr iterator operator++(int) { return *this; } + }; + + _LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const { + if (__id >= __size_) + __throw_format_error("Argument index out of bounds"); + return __args_[__id]; + } + + _LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const { + if (__id >= __size_) + __throw_format_error("Argument index out of bounds"); + return __handles_[__id]; + } + + _LIBCPP_HIDE_FROM_ABI constexpr iterator out() { return {}; } + _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(iterator) {} + +private: + const __arg_t* __args_; + const __compile_time_handle<_CharT>* __handles_; + size_t __size_; +}; + +_LIBCPP_HIDE_FROM_ABI +constexpr void __compile_time_validate_integral(__arg_t __type) { + switch (__type) { + case __arg_t::__int: + case __arg_t::__long_long: + case __arg_t::__i128: + case __arg_t::__unsigned: + case __arg_t::__unsigned_long_long: + case __arg_t::__u128: + return; + + default: + __throw_format_error("Argument isn't an integral type"); + } +} + +// _HasPrecision does the formatter have a precision? +template <class _CharT, class _Tp, bool _HasPrecision = false> +_LIBCPP_HIDE_FROM_ABI constexpr void +__compile_time_validate_argument(basic_format_parse_context<_CharT>& __parse_ctx, + __compile_time_basic_format_context<_CharT>& __ctx) { + formatter<_Tp, _CharT> __formatter; + __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); + // [format.string.std]/7 + // ... If the corresponding formatting argument is not of integral type, or + // its value is negative for precision or non-positive for width, an + // exception of type format_error is thrown. + // + // Validate whether the arguments are integrals. + if (__formatter.__width_needs_substitution()) + __format::__compile_time_validate_integral(__ctx.arg(__formatter.__width)); + + if constexpr (_HasPrecision) + if (__formatter.__precision_needs_substitution()) + __format::__compile_time_validate_integral(__ctx.arg(__formatter.__precision)); +} + +template <class _CharT> +_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(basic_format_parse_context<_CharT>& __parse_ctx, + __compile_time_basic_format_context<_CharT>& __ctx, + __arg_t __type) { + switch (__type) { + case __arg_t::__none: + __throw_format_error("Invalid argument"); + case __arg_t::__boolean: + return __format::__compile_time_validate_argument<_CharT, bool>(__parse_ctx, __ctx); + case __arg_t::__char_type: + return __format::__compile_time_validate_argument<_CharT, _CharT>(__parse_ctx, __ctx); + case __arg_t::__int: + return __format::__compile_time_validate_argument<_CharT, int>(__parse_ctx, __ctx); + case __arg_t::__long_long: + return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx); + case __arg_t::__i128: +# ifndef _LIBCPP_HAS_NO_INT128 + return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx); +# else + __throw_format_error("Invalid argument"); +# endif + return; + case __arg_t::__unsigned: + return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx); + case __arg_t::__unsigned_long_long: + return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx); + case __arg_t::__u128: +# ifndef _LIBCPP_HAS_NO_INT128 + return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx); +# else + __throw_format_error("Invalid argument"); +# endif + return; + case __arg_t::__float: + return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx); + case __arg_t::__double: + return __format::__compile_time_validate_argument<_CharT, double, true>(__parse_ctx, __ctx); + case __arg_t::__long_double: + return __format::__compile_time_validate_argument<_CharT, long double, true>(__parse_ctx, __ctx); + case __arg_t::__const_char_type_ptr: + return __format::__compile_time_validate_argument<_CharT, const _CharT*, true>(__parse_ctx, __ctx); + case __arg_t::__string_view: + return __format::__compile_time_validate_argument<_CharT, basic_string_view<_CharT>, true>(__parse_ctx, __ctx); + case __arg_t::__ptr: + return __format::__compile_time_validate_argument<_CharT, const void*>(__parse_ctx, __ctx); + case __arg_t::__handle: + __throw_format_error("Handle should use __compile_time_validate_handle_argument"); + } + __throw_format_error("Invalid argument"); +} + template <class _CharT, class _ParseCtx, class _Ctx> -_LIBCPP_HIDE_FROM_ABI const _CharT* +_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __handle_replacement_field(const _CharT* __begin, const _CharT* __end, _ParseCtx& __parse_ctx, _Ctx& __ctx) { __format::__parse_number_result __r = @@ -223,19 +390,26 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end, "The replacement field arg-id should terminate at a ':' or '}'"); } - _VSTD::visit_format_arg( - [&](auto __arg) { - if constexpr (same_as<decltype(__arg), monostate>) - __throw_format_error("Argument index out of bounds"); - else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>) - __arg.format(__parse_ctx, __ctx); - else { - formatter<decltype(__arg), _CharT> __formatter; - __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); - __ctx.advance_to(__formatter.format(__arg, __ctx)); - } - }, - __ctx.arg(__r.__value)); + if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) { + __arg_t __type = __ctx.arg(__r.__value); + if (__type == __arg_t::__handle) + __ctx.__handle(__r.__value).__parse(__parse_ctx); + else + __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type); + } else + _VSTD::visit_format_arg( + [&](auto __arg) { + if constexpr (same_as<decltype(__arg), monostate>) + __throw_format_error("Argument index out of bounds"); + else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>) + __arg.format(__parse_ctx, __ctx); + else { + formatter<decltype(__arg), _CharT> __formatter; + __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); + __ctx.advance_to(__formatter.format(__arg, __ctx)); + } + }, + __ctx.arg(__r.__value)); __begin = __parse_ctx.begin(); if (__begin == __end || *__begin != _CharT('}')) @@ -245,7 +419,7 @@ __handle_replacement_field(const _CharT* __begin, const _CharT* __end, } template <class _ParseCtx, class _Ctx> -_LIBCPP_HIDE_FROM_ABI typename _Ctx::iterator +_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) { using _CharT = typename _ParseCtx::char_type; static_assert(same_as<typename _Ctx::char_type, _CharT>); @@ -290,6 +464,56 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) { } // namespace __format +template <class _CharT, class... _Args> +struct _LIBCPP_TEMPLATE_VIS __basic_format_string { + basic_string_view<_CharT> __str_; + + template <class _Tp> + requires convertible_to<const _Tp&, basic_string_view<_CharT>> + consteval __basic_format_string(const _Tp& __str) : __str_{__str} { + __format::__vformat_to(basic_format_parse_context<_CharT>{__str_, sizeof...(_Args)}, + _Context{__types_.data(), __handles_.data(), sizeof...(_Args)}); + } + +private: + using _Context = __format::__compile_time_basic_format_context<_CharT>; + + static constexpr array<__format::__arg_t, sizeof...(_Args)> __types_{ + __format::__determine_arg_t<_Context, remove_cvref_t<_Args>>()...}; + + // TODO FMT remove this work-around when the AIX ICE has been resolved. +# if defined(_AIX) && defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1400 + template <class _Tp> + static constexpr __format::__compile_time_handle<_CharT> __get_handle() { + __format::__compile_time_handle<_CharT> __handle; + if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) + __handle.template __enable<_Tp>(); + + return __handle; + } + + static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{ + __get_handle<_Args>()...}; +# else + static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{[] { + using _Tp = remove_cvref_t<_Args>; + __format::__compile_time_handle<_CharT> __handle; + if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle) + __handle.template __enable<_Tp>(); + + return __handle; + }()...}; +# endif +}; + +template <class... _Args> +using __format_string_t = __basic_format_string<char, type_identity_t<_Args>...>; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <class... _Args> +using __wformat_string_t = __basic_format_string<wchar_t, type_identity_t<_Args>...>; +#endif + template <class _OutIt, class _CharT, class _FormatOutIt> requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to( @@ -328,16 +552,16 @@ vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { template <output_iterator<const char&> _OutIt, class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -format_to(_OutIt __out_it, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, +format_to(_OutIt __out_it, __format_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -format_to(_OutIt __out_it, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, +format_to(_OutIt __out_it, __wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -359,16 +583,16 @@ vformat(wstring_view __fmt, wformat_args __args) { #endif template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string -format(string_view __fmt, const _Args&... __args) { - return _VSTD::vformat(__fmt, _VSTD::make_format_args(__args...)); +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(__format_string_t<_Args...> __fmt, + const _Args&... __args) { + return _VSTD::vformat(__fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring -format(wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat(__fmt, _VSTD::make_wformat_args(__args...)); +format(__wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat(__fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -384,15 +608,16 @@ _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, template <output_iterator<const char&> _OutIt, class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> -format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, string_view __fmt, const _Args&... __args) { - return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, __fmt, _VSTD::make_format_args(__args...)); +format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, __format_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, __fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> -format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wstring_view __fmt, const _Args&... __args) { - return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, __fmt, _VSTD::make_wformat_args(__args...)); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> +format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, __wformat_string_t<_Args...> __fmt, + const _Args&... __args) { + return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, __fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -405,16 +630,16 @@ _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, } template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t formatted_size(string_view __fmt, - const _Args&... __args) { - return _VSTD::__vformatted_size(__fmt, basic_format_args{_VSTD::make_format_args(__args...)}); +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +formatted_size(__format_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::__vformatted_size(__fmt.__str_, basic_format_args{_VSTD::make_format_args(__args...)}); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t formatted_size(wstring_view __fmt, - const _Args&... __args) { - return _VSTD::__vformatted_size(__fmt, basic_format_args{_VSTD::make_wformat_args(__args...)}); +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +formatted_size(__wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::__vformatted_size(__fmt.__str_, basic_format_args{_VSTD::make_wformat_args(__args...)}); } #endif @@ -457,17 +682,17 @@ _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt v #endif template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( - _OutIt __out_it, locale __loc, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +format_to(_OutIt __out_it, locale __loc, __format_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( - _OutIt __out_it, locale __loc, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +format_to(_OutIt __out_it, locale __loc, __wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -491,17 +716,18 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) { #endif template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string -format(locale __loc, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat(_VSTD::move(__loc), __fmt, +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(locale __loc, + __format_string_t<_Args...> __fmt, + const _Args&... __args) { + return _VSTD::vformat(_VSTD::move(__loc), __fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring -format(locale __loc, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat(_VSTD::move(__loc), __fmt, +format(locale __loc, __wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::vformat(_VSTD::move(__loc), __fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -519,16 +745,18 @@ _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, template <output_iterator<const char&> _OutIt, class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> -format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, string_view __fmt, const _Args&... __args) { - return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt, +format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, __format_string_t<_Args...> __fmt, + const _Args&... __args) { + return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.__str_, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> -format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wstring_view __fmt, const _Args&... __args) { - return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt, +format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, __wformat_string_t<_Args...> __fmt, + const _Args&... __args) { + return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.__str_, _VSTD::make_wformat_args(__args...)); } #endif @@ -543,18 +771,16 @@ _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_ } template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t formatted_size(locale __loc, - string_view __fmt, - const _Args&... __args) { - return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt, basic_format_args{_VSTD::make_format_args(__args...)}); +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +formatted_size(locale __loc, __format_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.__str_, basic_format_args{_VSTD::make_format_args(__args...)}); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t formatted_size(locale __loc, - wstring_view __fmt, - const _Args&... __args) { - return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt, basic_format_args{_VSTD::make_wformat_args(__args...)}); +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +formatted_size(locale __loc, __wformat_string_t<_Args...> __fmt, const _Args&... __args) { + return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.__str_, basic_format_args{_VSTD::make_wformat_args(__args...)}); } #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index 23c1229e7b..3dd0308c22 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -184,9 +184,13 @@ template <class T, class Allocator, class Predicate> #include <__algorithm/min.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/move_iterator.h> +#include <__iterator/next.h> #include <__utility/forward.h> #include <initializer_list> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/fstream b/contrib/libs/cxxsupp/libcxx/include/fstream index 7608daa3f9..ffa75b14eb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/fstream +++ b/contrib/libs/cxxsupp/libcxx/include/fstream @@ -1734,9 +1734,9 @@ basic_fstream<_CharT, _Traits>::close() } #if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/iomanip b/contrib/libs/cxxsupp/libcxx/include/iomanip index 69b55be7cc..ed8334519a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iomanip +++ b/contrib/libs/cxxsupp/libcxx/include/iomanip @@ -44,7 +44,6 @@ template <class charT, class traits, class Allocator> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__string> #include <istream> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/istream b/contrib/libs/cxxsupp/libcxx/include/istream index 201339ff4d..7af5dfa474 100644 --- a/contrib/libs/cxxsupp/libcxx/include/istream +++ b/contrib/libs/cxxsupp/libcxx/include/istream @@ -160,6 +160,7 @@ template <class Stream, class T> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__iterator/istreambuf_iterator.h> #include <__utility/forward.h> #include <ostream> #include <version> @@ -1628,11 +1629,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) return __is; } -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>; #endif -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/iterator b/contrib/libs/cxxsupp/libcxx/include/iterator index 30c9a10139..f0bcff96ad 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/iterator @@ -723,13 +723,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; #include <type_traits> #include <version> -// TODO: remove these headers -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <exception> -#include <new> -#include <typeinfo> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index f362ef38aa..48d56c2201 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -188,11 +188,17 @@ template <class T, class Allocator, class Predicate> #include <__config> #include <__debug> #include <__format/enable_insertable.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 <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> #include <initializer_list> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <type_traits> @@ -299,19 +305,15 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif - - + } template<class, class> friend class list; template<class, class> friend class __list_imp; @@ -329,7 +331,7 @@ public: _VSTD::__debug_db_insert_i(this); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __list_iterator(const __list_iterator& __p) @@ -355,7 +357,7 @@ public: return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const @@ -412,17 +414,15 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { + (void)__c; +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif + } template<class, class> friend class list; template<class, class> friend class __list_imp; @@ -442,12 +442,12 @@ public: __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT : __ptr_(__p.__ptr_) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __get_db()->__iterator_copy(this, _VSTD::addressof(__p)); #endif } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY __list_const_iterator(const __list_const_iterator& __p) @@ -473,7 +473,7 @@ public: return *this; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE _LIBCPP_INLINE_VISIBILITY reference operator*() const { @@ -600,38 +600,22 @@ protected: _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_.__next_, this); -#else - return iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_.__next_, this); -#else - return const_iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_as_link(), this); -#else - return iterator(__end_as_link()); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_as_link(), this); -#else - return const_iterator(__end_as_link()); -#endif } void swap(__list_imp& __c) @@ -772,7 +756,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) else __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); @@ -1097,14 +1081,14 @@ public: return __hold_pointer(__p, __node_destructor(__na, 1)); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: _LIBCPP_INLINE_VISIBILITY @@ -1401,11 +1385,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__hold.release()->__as_link(), this); -#else - return iterator(__hold.release()->__as_link()); -#endif } template <class _Tp, class _Alloc> @@ -1414,11 +1394,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, n, x) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif if (__n > 0) { size_type __ds = 0; @@ -1426,11 +1402,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold->__as_link(), this); -#else - __r = iterator(__hold->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1456,11 +1428,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1479,11 +1447,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, range) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif if (__f != __l) { size_type __ds = 0; @@ -1491,11 +1455,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold.get()->__as_link(), this); -#else - __r = iterator(__hold.get()->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1521,11 +1481,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1644,11 +1600,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } template <class _Tp, class _Alloc> @@ -1664,11 +1616,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } #endif // _LIBCPP_CXX03_LANG @@ -1682,7 +1630,7 @@ list<_Tp, _Alloc>::pop_front() __link_pointer __n = base::__end_.__next_; base::__unlink_nodes(__n, __n); --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { @@ -1711,7 +1659,7 @@ list<_Tp, _Alloc>::pop_back() __link_pointer __n = base::__end_.__prev_; base::__unlink_nodes(__n, __n); --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { @@ -1744,7 +1692,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p) __link_pointer __r = __n->__next_; base::__unlink_nodes(__n, __n); --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __ip = __c->end_; __ip != __c->beg_; ) { @@ -1762,11 +1710,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p) __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__r, this); -#else - return iterator(__r); -#endif } template <class _Tp, class _Alloc> @@ -1786,7 +1730,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) __link_pointer __n = __f.__ptr_; ++__f; --base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { @@ -1806,11 +1750,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) __node_alloc_traits::deallocate(__na, __np, 1); } } -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__l.__ptr_, this); -#else - return iterator(__l.__ptr_); -#endif } template <class _Tp, class _Alloc> @@ -1827,11 +1767,7 @@ list<_Tp, _Alloc>::resize(size_type __n) __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__hold.release()->__as_link(), this); -#else - iterator __r = iterator(__hold.release()->__as_link()); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1856,11 +1792,7 @@ list<_Tp, _Alloc>::resize(size_type __n) __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1885,11 +1817,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; __link_pointer __nl = __hold.release()->__as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__nl, this); -#else - iterator __r = iterator(__nl); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1914,11 +1842,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1944,7 +1868,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) __link_nodes(__p.__ptr_, __f, __l); base::__sz() += __c.__sz(); __c.__sz() = 0; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (_VSTD::addressof(__c) != this) { __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); @@ -1958,7 +1882,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) __cn1->__add(*__ip); (*__ip)->__c_ = __cn1; if (--__cn2->end_ != __ip) - memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); } } __db->unlock(); @@ -1985,7 +1909,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) __link_nodes(__p.__ptr_, __f, __f); --__c.__sz(); ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (_VSTD::addressof(__c) != this) { __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); @@ -1999,7 +1923,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) __cn1->__add(*__ip); (*__ip)->__c_ = __cn1; if (--__cn2->end_ != __ip) - _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); + memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); } } __db->unlock(); @@ -2046,7 +1970,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con } base::__unlink_nodes(__first, __last); __link_nodes(__p.__ptr_, __first, __last); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (_VSTD::addressof(__c) != this) { __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); @@ -2183,7 +2107,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) ++__f1; } splice(__e1, __c); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); __c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c)); @@ -2307,7 +2231,7 @@ list<_Tp, _Alloc>::__invariants() const return size() == _VSTD::distance(begin(), end()); } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template <class _Tp, class _Alloc> bool @@ -2337,7 +2261,7 @@ list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const return false; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE template <class _Tp, class _Alloc> inline _LIBCPP_INLINE_VISIBILITY diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index e1842d525d..a59ad376da 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -187,6 +187,7 @@ template <class charT> class messages_byname; */ +#include <__algorithm/copy.h> #include <__algorithm/equal.h> #include <__algorithm/find.h> #include <__algorithm/max.h> @@ -195,6 +196,10 @@ template <class charT> class messages_byname; #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> +#include <__iterator/access.h> +#include <__iterator/back_insert_iterator.h> +#include <__iterator/istreambuf_iterator.h> +#include <__iterator/ostreambuf_iterator.h> #include <__locale> #ifndef __APPLE__ # include <cstdarg> @@ -203,7 +208,7 @@ template <class charT> class messages_byname; #include <cstdlib> #include <ctime> #include <ios> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <streambuf> @@ -577,9 +582,9 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex return 0; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>; #endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > @@ -1117,9 +1122,9 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>; #endif struct _LIBCPP_TYPE_VIS __num_put_base @@ -1269,9 +1274,9 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, __op = __ob + (__np - __nb); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>; #endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > @@ -1461,7 +1466,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, return do_put(__s, __iob, __fl, (unsigned long)__v); const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc()); typedef typename numpunct<char_type>::string_type string_type; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE string_type __tmp(__v ? __np.truename() : __np.falsename()); string_type __nm = _VSTD::move(__tmp); #else @@ -1640,9 +1645,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; #endif template <class _CharT, class _InputIterator> @@ -2341,9 +2346,9 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>; #endif class _LIBCPP_TYPE_VIS __time_get @@ -2443,9 +2448,9 @@ private: virtual const string_type& __X() const {return this->__X_;} }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>; #endif class _LIBCPP_TYPE_VIS __time_put @@ -2558,9 +2563,9 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, return _VSTD::copy(__nb, __ne, __s); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>; #endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > @@ -2585,9 +2590,9 @@ protected: #endif }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>; #endif // money_base @@ -2654,11 +2659,11 @@ template <class _CharT, bool _International> const bool moneypunct<_CharT, _International>::intl; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>) +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 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>) +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 // moneypunct_byname @@ -2710,14 +2715,14 @@ private: template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, false>::init(const char*); template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*); -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>) +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 template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*); template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*); -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>) +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 // money_get @@ -2774,9 +2779,9 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, } } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>; #endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > @@ -3143,9 +3148,9 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>; #endif // money_put @@ -3320,9 +3325,9 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m __mi = __mb; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>; #endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > @@ -3475,9 +3480,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>; #endif // messages @@ -3593,9 +3598,9 @@ messages<_CharT>::do_close(catalog __c) const #endif // _LIBCPP_HAS_CATOPEN } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>; #endif template <class _CharT> @@ -3619,9 +3624,9 @@ protected: ~messages_byname() {} }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>; #endif template<class _Codecvt, class _Elem = wchar_t, diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index ed4b0b91c7..640d7a6f05 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -535,14 +535,16 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__functional/binary_function.h> #include <__functional/is_transparent.h> #include <__functional/operations.h> +#include <__iterator/erase_if_container.h> #include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__node_handle> #include <__tree> #include <__utility/forward.h> #include <__utility/swap.h> #include <compare> #include <initializer_list> -#include <iterator> // __libcpp_erase_if_container +#include <iterator> // TODO: Remove this include #include <memory> #include <type_traits> #include <version> diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index 5b6fda6988..616ee7b5d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -864,7 +864,7 @@ template<size_t N, class T> #include <cstdint> #include <cstring> #include <iosfwd> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <new> #include <stdexcept> #include <stlfwd> diff --git a/contrib/libs/cxxsupp/libcxx/include/numeric b/contrib/libs/cxxsupp/libcxx/include/numeric index 9378f98cc3..6ece54612b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numeric +++ b/contrib/libs/cxxsupp/libcxx/include/numeric @@ -147,7 +147,7 @@ template<class T> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <cmath> // for isnormal -#include <iterator> +#include <iterator> // TODO: Remove this include #include <version> #include <__numeric/accumulate.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index bc004351b6..87e1617f16 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -178,11 +178,6 @@ template<class T> #include <type_traits> #include <version> -// TODO: remove these headers -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <typeinfo> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -393,9 +388,9 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> } }; -// optional<T&> is currently required ill-formed, however it may to be in the -// future. For this reason it has already been implemented to ensure we can -// make the change in an ABI compatible manner. +// optional<T&> is currently required to be ill-formed. However, it may +// be allowed in the future. For this reason, it has already been implemented +// to ensure we can make the change in an ABI-compatible manner. template <class _Tp> struct __optional_storage_base<_Tp, true> { diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream index 702f505d4f..9679e42b31 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ostream +++ b/contrib/libs/cxxsupp/libcxx/include/ostream @@ -138,7 +138,7 @@ template <class Stream, class T> #include <__config> #include <bitset> #include <ios> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <locale> #include <streambuf> #include <version> @@ -1095,9 +1095,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/regex b/contrib/libs/cxxsupp/libcxx/include/regex index 5d078744c5..a6ad7d625a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/regex +++ b/contrib/libs/cxxsupp/libcxx/include/regex @@ -766,6 +766,8 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #include <__algorithm/search.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__iterator/access.h> +#include <__iterator/back_insert_iterator.h> #include <__iterator/wrap_iter.h> #include <__locale> #include <__utility/move.h> @@ -773,7 +775,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #include <compare> #include <deque> #include <initializer_list> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <memory> #include <stdexcept> #include <string> diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index ccf9542cac..af035dc6b5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -477,13 +477,15 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 #include <__config> #include <__functional/is_transparent.h> #include <__functional/operations.h> +#include <__iterator/erase_if_container.h> #include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__node_handle> #include <__tree> #include <__utility/forward.h> #include <compare> #include <initializer_list> -#include <iterator> // __libcpp_erase_if_container +#include <iterator> // TODO: Remove this include #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index 0b73a1ecf6..7950396137 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -132,7 +132,9 @@ template<class R> #include <__debug> #include <__fwd/span.h> #include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> #include <__iterator/wrap_iter.h> +#include <__memory/pointer_traits.h> #include <__ranges/concepts.h> #include <__ranges/data.h> #include <__ranges/enable_borrowed_range.h> @@ -141,7 +143,7 @@ template<class R> #include <__utility/forward.h> #include <array> // for array #include <cstddef> // for byte -#include <iterator> // for iterators +#include <iterator> // TODO: Remove this include #include <limits> #include <type_traits> // for remove_cv, etc #include <version> @@ -197,6 +199,10 @@ concept __span_compatible_range = is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>; #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +# define _LIBCPP_SPAN_USE_POINTER_ITERATOR +#endif + template <typename _Tp, size_t _Extent> class _LIBCPP_TEMPLATE_VIS span { public: @@ -209,7 +215,7 @@ public: using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR using iterator = pointer; #else using iterator = __wrap_iter<pointer>; @@ -381,8 +387,20 @@ public: _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data()); +#else + return iterator(this, data()); +#endif + } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data() + size()); +#else + return iterator(this, data() + size()); +#endif + } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } @@ -412,7 +430,7 @@ public: using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR using iterator = pointer; #else using iterator = __wrap_iter<pointer>; @@ -560,8 +578,20 @@ public: _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data()); +#else + return iterator(this, data()); +#endif + } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data() + size()); +#else + return iterator(this, data() + size()); +#endif + } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } diff --git a/contrib/libs/cxxsupp/libcxx/include/sstream b/contrib/libs/cxxsupp/libcxx/include/sstream index 4ab3af74f0..602a1b55b4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/sstream +++ b/contrib/libs/cxxsupp/libcxx/include/sstream @@ -861,10 +861,10 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, } #if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>) +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 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/streambuf b/contrib/libs/cxxsupp/libcxx/include/streambuf index d76f6d0379..53a71720f1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/streambuf +++ b/contrib/libs/cxxsupp/libcxx/include/streambuf @@ -488,11 +488,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type) return traits_type::eof(); } -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>; -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index e114b28a6e..4233cdd8cb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -524,10 +524,16 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <__config> #include <__debug> #include <__format/enable_insertable.h> +#include <__functional/hash.h> #include <__functional/unary_function.h> #include <__ios/fpos.h> +#include <__iterator/distance.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> #include <__memory/allocate_at_least.h> +#include <__string/char_traits.h> +#include <__string/extern_template_lists.h> #include <__utility/auto_cast.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -539,7 +545,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <cstring> #include <initializer_list> #include <iosfwd> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <memory> #include <stdexcept> @@ -547,10 +553,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <type_traits> #include <version> -// TODO: remove these headers -#include <new> -#include <typeinfo> - #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # include <cwchar> #endif @@ -601,7 +603,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&)) +extern template _LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&); template <class _Iter> struct __string_is_trivial_iterator : public false_type {}; @@ -696,8 +698,8 @@ private: { value_type __data_[__min_cap]; unsigned char __padding_[sizeof(value_type) - 1]; - size_type __size_ : 7; - size_type __is_long_ : 1; + unsigned char __size_ : 7; + unsigned char __is_long_ : 1; }; // The __endian_factor is required because the field we use to store the size @@ -740,14 +742,16 @@ private: struct __short { - size_type __is_long_ : 1; - size_type __size_ : 7; + unsigned char __is_long_ : 1; + unsigned char __size_ : 7; char __padding_[sizeof(value_type) - 1]; value_type __data_[__min_cap]; }; #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT + static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size."); + union __ulx{__long __lx; __short __lxx;}; enum {__n_words = sizeof(__ulx) / sizeof(size_type)}; @@ -817,10 +821,6 @@ public: _NOEXCEPT; #endif -#if _LIBCPP_STD_VER > 17 - basic_string(nullptr_t) = delete; -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(basic_string&& __str, const allocator_type& __a); #endif // _LIBCPP_CXX03_LANG @@ -837,6 +837,9 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const _CharT* __s, const _Allocator& __a); +#if _LIBCPP_STD_VER > 17 + basic_string(nullptr_t) = delete; +#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(nullptr_t, size_t) = delete; @@ -920,7 +923,7 @@ public: #endif _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c); -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() _NOEXCEPT {return iterator(this, __get_pointer());} @@ -934,6 +937,8 @@ public: const_iterator end() const _NOEXCEPT {return const_iterator(this, __get_pointer() + size());} #else + // It is necessary to keep the list of constructors matching the one above it. + // Made to support pointer iterators _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() _NOEXCEPT {return iterator(__get_pointer());} @@ -946,7 +951,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_iterator end() const _NOEXCEPT {return const_iterator(__get_pointer() + size());} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -1473,7 +1479,7 @@ public: constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(const value_type* __s) const noexcept { return ends_with(__self_view(__s)); } -//#endif +//#endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_HIDE_FROM_ABI @@ -1493,14 +1499,14 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: template<class _Alloc> @@ -1837,17 +1843,19 @@ private: // These declarations must appear before any functions are implicitly used // so that they have the correct visibility specifier. +#define _LIBCPP_DECLARE(...) extern template __VA_ARGS__; #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char) + _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t) + _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t) # endif #else - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char) + _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, char) # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t) + _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t) # endif #endif +#undef _LIBCPP_DECLARE #if _LIBCPP_STD_VER >= 17 @@ -1883,7 +1891,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE if (!__libcpp_is_constant_evaluated()) { __c_node* __c = __get_db()->__find_c_and_lock(this); if (__c) @@ -1905,7 +1913,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type } #else (void)__pos; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE } template <class _CharT, class _Traits, class _Allocator> @@ -2462,7 +2470,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); - return (_LIBCPP_BUILTIN_CONSTANT_P(__n) && __fits_in_sso(__n)) + return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); } @@ -2677,7 +2685,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); - return _LIBCPP_BUILTIN_CONSTANT_P(*__s) + return __builtin_constant_p(*__s) ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s)) : __assign_external(__s, traits_type::length(__s))) @@ -4638,7 +4646,7 @@ inline _LIBCPP_HIDE_FROM_ABI } #endif -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template<class _CharT, class _Traits, class _Allocator> bool @@ -4672,7 +4680,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* return data() <= __p && __p < data() + size(); } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE #if _LIBCPP_STD_VER > 11 // Literal suffixes for basic_string [basic.string.literals] @@ -4729,10 +4737,6 @@ inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>> _LIBCPP_END_NAMESPACE_STD -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( pop ) -#endif - _LIBCPP_POP_MACROS #endif // _LIBCPP_STRING diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index aa1a7942a5..187dfa3a15 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -199,17 +199,22 @@ namespace std { #include <__algorithm/min.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/hash.h> #include <__functional/unary_function.h> #include <__fwd/string_view.h> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> +#include <__iterator/reverse_iterator.h> +#include <__memory/pointer_traits.h> #include <__ranges/concepts.h> #include <__ranges/data.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> -#include <__string> +#include <__string/char_traits.h> #include <compare> #include <iosfwd> -#include <iterator> +#include <iterator> // TODO: Remove this include #include <limits> #include <stdexcept> #include <type_traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/system_error b/contrib/libs/cxxsupp/libcxx/include/system_error index d8ab54ceae..770092ebe6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/system_error +++ b/contrib/libs/cxxsupp/libcxx/include/system_error @@ -145,6 +145,7 @@ template <> struct hash<std::error_condition>; #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__errc> +#include <__functional/hash.h> #include <__functional/unary_function.h> #include <compare> #include <stdexcept> diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index 20708f119c..4bb3c7a004 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -84,6 +84,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/hash.h> #include <__mutex_base> #include <__thread/poll_with_backoff.h> #include <__thread/timed_backoff_policy.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index cbafce78c6..ce0abeb5e0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -25,14 +25,24 @@ public: explicit(see-below) tuple(U&&...); // constexpr in C++14 tuple(const tuple&) = default; tuple(tuple&&) = default; + + template<class... UTypes> + constexpr explicit(see-below) tuple(tuple<UTypes...>&); // C++23 template <class... U> explicit(see-below) tuple(const tuple<U...>&); // constexpr in C++14 template <class... U> explicit(see-below) tuple(tuple<U...>&&); // constexpr in C++14 + template<class... UTypes> + constexpr explicit(see-below) tuple(const tuple<UTypes...>&&); // C++23 + + template<class U1, class U2> + constexpr explicit(see-below) tuple(pair<U1, U2>&); // iff sizeof...(Types) == 2 // C++23 template <class U1, class U2> explicit(see-below) tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14 template <class U1, class U2> explicit(see-below) tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14 + template<class U1, class U2> + constexpr explicit(see-below) tuple(const pair<U1, U2>&&); // iff sizeof...(Types) == 2 // C++23 // allocator-extended constructors template <class Alloc> @@ -45,25 +55,47 @@ public: tuple(allocator_arg_t, const Alloc& a, const tuple&); // constexpr in C++20 template <class Alloc> tuple(allocator_arg_t, const Alloc& a, tuple&&); // constexpr in C++20 + template<class Alloc, class... UTypes> + constexpr explicit(see-below) + tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&); // C++23 template <class Alloc, class... U> explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&); // constexpr in C++20 template <class Alloc, class... U> explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&); // constexpr in C++20 + template<class Alloc, class... UTypes> + constexpr explicit(see-below) + tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&&); // C++23 + template<class Alloc, class U1, class U2> + constexpr explicit(see-below) + tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&); // C++23 template <class Alloc, class U1, class U2> explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); // constexpr in C++20 template <class Alloc, class U1, class U2> explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&); // constexpr in C++20 + template<class Alloc, class U1, class U2> + constexpr explicit(see-below) + tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&); // C++23 tuple& operator=(const tuple&); // constexpr in C++20 + constexpr const tuple& operator=(const tuple&) const; // C++23 tuple& operator=(tuple&&) noexcept(is_nothrow_move_assignable_v<T> && ...); // constexpr in C++20 + constexpr const tuple& operator=(tuple&&) const; // C++23 template <class... U> tuple& operator=(const tuple<U...>&); // constexpr in C++20 + template<class... UTypes> + constexpr const tuple& operator=(const tuple<UTypes...>&) const; // C++23 template <class... U> tuple& operator=(tuple<U...>&&); // constexpr in C++20 + template<class... UTypes> + constexpr const tuple& operator=(tuple<UTypes...>&&) const; // C++23 template <class U1, class U2> tuple& operator=(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++20 + template<class U1, class U2> + constexpr const tuple& operator=(const pair<U1, U2>&) const; // iff sizeof...(Types) == 2 // C++23 template <class U1, class U2> tuple& operator=(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++20 + template<class U1, class U2> + constexpr const tuple& operator=(pair<U1, U2>&&) const; // iff sizeof...(Types) == 2 // C++23 template<class U, size_t N> tuple& operator=(array<U, N> const&) // iff sizeof...(T) == N, EXTENSION @@ -71,6 +103,7 @@ public: tuple& operator=(array<U, N>&&) // iff sizeof...(T) == N, EXTENSION void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...)); // constexpr in C++20 + constexpr void swap(const tuple&) const noexcept(see-below); // C++23 }; @@ -161,6 +194,9 @@ template <class... Types> void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y))); +template <class... Types> + constexpr void swap(const tuple<Types...>& x, const tuple<Types...>& y) noexcept(see-below); // C++23 + } // std */ @@ -184,11 +220,6 @@ template <class... Types> #include <type_traits> #include <version> -// TODO: remove these headers -#include <exception> -#include <new> -#include <typeinfo> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -213,6 +244,13 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) swap(__x.get(), __y.get()); } +template <size_t _Ip, class _Hp, bool _Ep> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 +void swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y) + _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) { + swap(__x.get(), __y.get()); +} + template <size_t _Ip, class _Hp, bool> class __tuple_leaf { @@ -301,6 +339,12 @@ public: return 0; } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + int swap(const __tuple_leaf& __t) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) { + _VSTD::swap(*this, __t); + return 0; + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} }; @@ -367,6 +411,12 @@ public: return 0; } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + int swap(const __tuple_leaf& __rhs) const _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) { + _VSTD::swap(*this, __rhs); + return 0; + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);} }; @@ -474,6 +524,13 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. { _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); } + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + void swap(const __tuple_impl& __t) const + _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value) + { + _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...); + } }; template<class _Dest, class _Source, size_t ..._Np> @@ -709,6 +766,7 @@ public: template <class _Alloc, template<class...> class _And = _And, __enable_if_t< _And<is_copy_constructible<_Tp>...>::value , int> = 0> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t) : __base_(allocator_arg_t(), __alloc, __t) { } @@ -716,30 +774,39 @@ public: template <class _Alloc, template<class...> class _And = _And, __enable_if_t< _And<is_move_constructible<_Tp>...>::value , int> = 0> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t) : __base_(allocator_arg_t(), __alloc, _VSTD::move(__t)) { } // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants) - template <class ..._Up> - struct _EnableCopyFromOtherTuple : _And< - _Not<is_same<tuple<_Tp...>, tuple<_Up...> > >, - _Lazy<_Or, - _BoolConstant<sizeof...(_Tp) != 1>, + + template <class _OtherTuple, class _DecayedOtherTuple = __uncvref_t<_OtherTuple>, class = void> + struct _EnableCtorFromUTypesTuple : false_type {}; + + template <class _OtherTuple, class... _Up> + struct _EnableCtorFromUTypesTuple<_OtherTuple, tuple<_Up...>, + // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below + __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>> : _And< + // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor can work. + // Otherwise, is_constructible can trigger hard error in those cases https://godbolt.org/z/M94cGdKcE + _Not<is_same<_OtherTuple, const tuple&> >, + _Not<is_same<_OtherTuple, tuple&&> >, + is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >..., + _Lazy<_Or, _BoolConstant<sizeof...(_Tp) != 1>, // _Tp and _Up are 1-element packs - the pack expansions look // weird to avoid tripping up the type traits in degenerate cases _Lazy<_And, - _Not<is_convertible<const tuple<_Up>&, _Tp> >..., - _Not<is_constructible<_Tp, const tuple<_Up>&> >... + _Not<is_same<_Tp, _Up> >..., + _Not<is_convertible<_OtherTuple, _Tp> >..., + _Not<is_constructible<_Tp, _OtherTuple> >... > - >, - is_constructible<_Tp, const _Up&>... - > { }; + > + > {}; template <class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableCopyFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<const tuple<_Up...>&>, is_convertible<const _Up&, _Tp>... // explicit check >::value , int> = 0> @@ -751,8 +818,7 @@ public: template <class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableCopyFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<const tuple<_Up...>&>, _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> > // explicit check >::value , int> = 0> @@ -764,8 +830,7 @@ public: template <class ..._Up, class _Alloc, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableCopyFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<const tuple<_Up...>&>, is_convertible<const _Up&, _Tp>... // explicit check >::value , int> = 0> @@ -776,8 +841,7 @@ public: template <class ..._Up, class _Alloc, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableCopyFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<const tuple<_Up...>&>, _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> > // explicit check >::value , int> = 0> @@ -786,26 +850,27 @@ public: : __base_(allocator_arg_t(), __a, __t) { } +#if _LIBCPP_STD_VER > 20 + // tuple(tuple<U...>&) constructors (including allocator_arg_t variants) + + template <class... _Up, enable_if_t< + _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!(is_convertible_v<_Up&, _Tp> && ...)) + tuple(tuple<_Up...>& __t) : __base_(__t) {} + + template <class _Alloc, class... _Up, enable_if_t< + _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!(is_convertible_v<_Up&, _Tp> && ...)) + tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) : __base_(allocator_arg_t(), __alloc, __t) {} +#endif // _LIBCPP_STD_VER > 20 + // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants) - template <class ..._Up> - struct _EnableMoveFromOtherTuple : _And< - _Not<is_same<tuple<_Tp...>, tuple<_Up...> > >, - _Lazy<_Or, - _BoolConstant<sizeof...(_Tp) != 1>, - // _Tp and _Up are 1-element packs - the pack expansions look - // weird to avoid tripping up the type traits in degenerate cases - _Lazy<_And, - _Not<is_convertible<tuple<_Up>, _Tp> >..., - _Not<is_constructible<_Tp, tuple<_Up> > >... - > - >, - is_constructible<_Tp, _Up>... - > { }; template <class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableMoveFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<tuple<_Up...>&&>, is_convertible<_Up, _Tp>... // explicit check >::value , int> = 0> @@ -817,8 +882,7 @@ public: template <class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableMoveFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<tuple<_Up...>&&>, _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check >::value , int> = 0> @@ -830,8 +894,7 @@ public: template <class _Alloc, class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableMoveFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<tuple<_Up...>&&>, is_convertible<_Up, _Tp>... // explicit check >::value , int> = 0> @@ -842,8 +905,7 @@ public: template <class _Alloc, class ..._Up, __enable_if_t< _And< - _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, - _EnableMoveFromOtherTuple<_Up...>, + _EnableCtorFromUTypesTuple<tuple<_Up...>&&>, _Not<_Lazy<_And, is_convertible<_Up, _Tp>...> > // explicit check >::value , int> = 0> @@ -852,57 +914,77 @@ public: : __base_(allocator_arg_t(), __a, _VSTD::move(__t)) { } +#if _LIBCPP_STD_VER > 20 + // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants) + + template <class... _Up, enable_if_t< + _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!(is_convertible_v<const _Up&&, _Tp> && ...)) + tuple(const tuple<_Up...>&& __t) : __base_(std::move(__t)) {} + + template <class _Alloc, class... _Up, enable_if_t< + _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!(is_convertible_v<const _Up&&, _Tp> && ...)) + tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t) + : __base_(allocator_arg_t(), __alloc, std::move(__t)) {} +#endif // _LIBCPP_STD_VER > 20 + // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants) - template <class _Up1, class _Up2, class ..._DependentTp> - struct _EnableImplicitCopyFromPair : _And< - is_constructible<_FirstType<_DependentTp...>, const _Up1&>, - is_constructible<_SecondType<_DependentTp...>, const _Up2&>, - is_convertible<const _Up1&, _FirstType<_DependentTp...> >, // explicit check - is_convertible<const _Up2&, _SecondType<_DependentTp...> > - > { }; - template <class _Up1, class _Up2, class ..._DependentTp> - struct _EnableExplicitCopyFromPair : _And< - is_constructible<_FirstType<_DependentTp...>, const _Up1&>, - is_constructible<_SecondType<_DependentTp...>, const _Up2&>, - _Not<is_convertible<const _Up1&, _FirstType<_DependentTp...> > >, // explicit check - _Not<is_convertible<const _Up2&, _SecondType<_DependentTp...> > > - > { }; + template <template <class...> class Pred, class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> + struct _CtorPredicateFromPair : false_type{}; + + template <template <class...> class Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2> + struct _CtorPredicateFromPair<Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And< + Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >, + Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> > + > {}; + + template <class _Pair> + struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair>{}; + + template <class _Pair> + struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair>{}; + + template <class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> + struct _BothImplicitlyConvertible : false_type{}; + + template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2> + struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : _And< + is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>, + is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2> + > {}; template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableImplicitCopyFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<const pair<_Up1, _Up2>&>, + _BothImplicitlyConvertible<const pair<_Up1, _Up2>&> // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const pair<_Up1, _Up2>& __p) - _NOEXCEPT_((_And< - is_nothrow_constructible<_FirstType<_Tp...>, const _Up1&>, - is_nothrow_constructible<_SecondType<_Tp...>, const _Up2&> - >::value)) + _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)) : __base_(__p) { } template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableExplicitCopyFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<const pair<_Up1, _Up2>&>, + _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> > // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const pair<_Up1, _Up2>& __p) - _NOEXCEPT_((_And< - is_nothrow_constructible<_FirstType<_Tp...>, const _Up1&>, - is_nothrow_constructible<_SecondType<_Tp...>, const _Up2&> - >::value)) + _NOEXCEPT_((_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)) : __base_(__p) { } template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableImplicitCopyFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<const pair<_Up1, _Up2>&>, + _BothImplicitlyConvertible<const pair<_Up1, _Up2>&> // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -912,8 +994,8 @@ public: template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableExplicitCopyFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<const pair<_Up1, _Up2>&>, + _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> > // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -921,57 +1003,52 @@ public: : __base_(allocator_arg_t(), __a, __p) { } - // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants) - template <class _Up1, class _Up2, class ..._DependentTp> - struct _EnableImplicitMoveFromPair : _And< - is_constructible<_FirstType<_DependentTp...>, _Up1>, - is_constructible<_SecondType<_DependentTp...>, _Up2>, - is_convertible<_Up1, _FirstType<_DependentTp...> >, // explicit check - is_convertible<_Up2, _SecondType<_DependentTp...> > - > { }; +#if _LIBCPP_STD_VER > 20 + // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants) + + template <class _U1, class _U2, enable_if_t< + _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value) + tuple(pair<_U1, _U2>& __p) : __base_(__p) {} + + template <class _Alloc, class _U1, class _U2, enable_if_t< + _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value) + tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p) : __base_(allocator_arg_t(), __alloc, __p) {} +#endif - template <class _Up1, class _Up2, class ..._DependentTp> - struct _EnableExplicitMoveFromPair : _And< - is_constructible<_FirstType<_DependentTp...>, _Up1>, - is_constructible<_SecondType<_DependentTp...>, _Up2>, - _Not<is_convertible<_Up1, _FirstType<_DependentTp...> > >, // explicit check - _Not<is_convertible<_Up2, _SecondType<_DependentTp...> > > - > { }; + // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants) template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableImplicitMoveFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<pair<_Up1, _Up2>&&>, + _BothImplicitlyConvertible<pair<_Up1, _Up2>&&> // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(pair<_Up1, _Up2>&& __p) - _NOEXCEPT_((_And< - is_nothrow_constructible<_FirstType<_Tp...>, _Up1>, - is_nothrow_constructible<_SecondType<_Tp...>, _Up2> - >::value)) + _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)) : __base_(_VSTD::move(__p)) { } template <class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableExplicitMoveFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<pair<_Up1, _Up2>&&>, + _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> > // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(pair<_Up1, _Up2>&& __p) - _NOEXCEPT_((_And< - is_nothrow_constructible<_FirstType<_Tp...>, _Up1>, - is_nothrow_constructible<_SecondType<_Tp...>, _Up2> - >::value)) + _NOEXCEPT_((_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)) : __base_(_VSTD::move(__p)) { } template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableImplicitMoveFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<pair<_Up1, _Up2>&&>, + _BothImplicitlyConvertible<pair<_Up1, _Up2>&&> // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -981,8 +1058,8 @@ public: template <class _Alloc, class _Up1, class _Up2, template<class...> class _And = _And, __enable_if_t< _And< - _BoolConstant<sizeof...(_Tp) == 2>, - _EnableExplicitMoveFromPair<_Up1, _Up2, _Tp...> + _EnableCtorFromPair<pair<_Up1, _Up2>&&>, + _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> > // explicit check >::value , int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -990,6 +1067,23 @@ public: : __base_(allocator_arg_t(), __a, _VSTD::move(__p)) { } +#if _LIBCPP_STD_VER > 20 + // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants) + + template <class _U1, class _U2, enable_if_t< + _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value) + tuple(const pair<_U1, _U2>&& __p) : __base_(std::move(__p)) {} + + template <class _Alloc, class _U1, class _U2, enable_if_t< + _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value) + tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p) + : __base_(allocator_arg_t(), __alloc, std::move(__p)) {} +#endif // _LIBCPP_STD_VER > 20 + // [tuple.assign] _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) @@ -1000,6 +1094,25 @@ public: return *this; } +#if _LIBCPP_STD_VER > 20 + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(tuple const& __tuple) const + requires (_And<is_copy_assignable<const _Tp>...>::value) { + std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type()); + return *this; + } + + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(tuple&& __tuple) const + requires (_And<is_assignable<const _Tp&, _Tp>...>::value) { + std::__memberwise_forward_assign(*this, + std::move(__tuple), + __tuple_types<_Tp...>(), + typename __make_tuple_indices<sizeof...(_Tp)>::type()); + return *this; + } +#endif // _LIBCPP_STD_VER > 20 + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) _NOEXCEPT_((_And<is_nothrow_move_assignable<_Tp>...>::value)) @@ -1041,38 +1154,89 @@ public: return *this; } - template<class _Up1, class _Up2, class _Dep = true_type, __enable_if_t< - _And<_Dep, - _BoolConstant<sizeof...(_Tp) == 2>, - is_assignable<_FirstType<_Tp..., _Dep>&, _Up1 const&>, - is_assignable<_SecondType<_Tp..., _Dep>&, _Up2 const&> - >::value + +#if _LIBCPP_STD_VER > 20 + template <class... _UTypes, enable_if_t< + _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>, + is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(const tuple<_UTypes...>& __u) const { + std::__memberwise_copy_assign(*this, + __u, + typename __make_tuple_indices<sizeof...(_Tp)>::type()); + return *this; + } + + template <class... _UTypes, enable_if_t< + _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>, + is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(tuple<_UTypes...>&& __u) const { + std::__memberwise_forward_assign(*this, + __u, + __tuple_types<_UTypes...>(), + typename __make_tuple_indices<sizeof...(_Tp)>::type()); + return *this; + } +#endif // _LIBCPP_STD_VER > 20 + + template <template<class...> class Pred, bool _Const, + class _Pair, class _DecayedPair = __uncvref_t<_Pair>, class _Tuple = tuple> + struct _AssignPredicateFromPair : false_type {}; + + template <template<class...> class Pred, bool _Const, + class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2> + struct _AssignPredicateFromPair<Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> > : + _And<Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >, + Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> > + > {}; + + template <bool _Const, class _Pair> + struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {}; + + template <bool _Const, class _Pair> + struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {}; + +#if _LIBCPP_STD_VER > 20 + template <class _U1, class _U2, enable_if_t< + _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(const pair<_U1, _U2>& __pair) const + noexcept(_NothrowAssignFromPair<true, const pair<_U1, _U2>&>::value) { + std::get<0>(*this) = __pair.first; + std::get<1>(*this) = __pair.second; + return *this; + } + + template <class _U1, class _U2, enable_if_t< + _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr> + _LIBCPP_HIDE_FROM_ABI constexpr + const tuple& operator=(pair<_U1, _U2>&& __pair) const + noexcept(_NothrowAssignFromPair<true, pair<_U1, _U2>&&>::value) { + std::get<0>(*this) = std::move(__pair.first); + std::get<1>(*this) = std::move(__pair.second); + return *this; + } +#endif // _LIBCPP_STD_VER > 20 + + template<class _Up1, class _Up2, __enable_if_t< + _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value ,int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(pair<_Up1, _Up2> const& __pair) - _NOEXCEPT_((_And< - is_nothrow_assignable<_FirstType<_Tp...>&, _Up1 const&>, - is_nothrow_assignable<_SecondType<_Tp...>&, _Up2 const&> - >::value)) + _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value)) { _VSTD::get<0>(*this) = __pair.first; _VSTD::get<1>(*this) = __pair.second; return *this; } - template<class _Up1, class _Up2, class _Dep = true_type, __enable_if_t< - _And<_Dep, - _BoolConstant<sizeof...(_Tp) == 2>, - is_assignable<_FirstType<_Tp..., _Dep>&, _Up1>, - is_assignable<_SecondType<_Tp..., _Dep>&, _Up2> - >::value + template<class _Up1, class _Up2, __enable_if_t< + _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value ,int> = 0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(pair<_Up1, _Up2>&& __pair) - _NOEXCEPT_((_And< - is_nothrow_assignable<_FirstType<_Tp...>&, _Up1>, - is_nothrow_assignable<_SecondType<_Tp...>&, _Up2> - >::value)) + _NOEXCEPT_((_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value)) { _VSTD::get<0>(*this) = _VSTD::forward<_Up1>(__pair.first); _VSTD::get<1>(*this) = _VSTD::forward<_Up2>(__pair.second); @@ -1116,6 +1280,13 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} + +#if _LIBCPP_STD_VER > 20 + _LIBCPP_HIDE_FROM_ABI constexpr + void swap(const tuple& __t) const noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) { + __base_.swap(__t.__base_); + } +#endif // _LIBCPP_STD_VER > 20 }; template <> @@ -1138,6 +1309,9 @@ public: tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(tuple&) _NOEXCEPT {} +#if _LIBCPP_STD_VER > 20 + _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {} +#endif }; #if _LIBCPP_STD_VER > 20 @@ -1178,6 +1352,16 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);} +#if _LIBCPP_STD_VER > 20 +template <class... _Tp> +_LIBCPP_HIDE_FROM_ABI constexpr +enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void> +swap(const tuple<_Tp...>& __lhs, const tuple<_Tp...>& __rhs) + noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) { + __lhs.swap(__rhs); +} +#endif + // get template <size_t _Ip, class ..._Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index 8c192b78a4..469d82df51 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -418,28 +418,42 @@ namespace std */ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/invoke.h> #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_pointer.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/add_volatile.h> +#include <__type_traits/alignment_of.h> +#include <__type_traits/apply_cv.h> #include <__type_traits/conditional.h> +#include <__type_traits/conjunction.h> #include <__type_traits/decay.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/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_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_copy_assignable.h> +#include <__type_traits/is_copy_constructible.h> +#include <__type_traits/is_default_constructible.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> @@ -447,23 +461,49 @@ namespace std #include <__type_traits/is_function.h> #include <__type_traits/is_fundamental.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_move_assignable.h> +#include <__type_traits/is_move_constructible.h> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_nothrow_copy_assignable.h> +#include <__type_traits/is_nothrow_copy_constructible.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_destructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.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_standard_layout.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_copy_assignable.h> +#include <__type_traits/is_trivially_copy_constructible.h> +#include <__type_traits/is_trivially_copyable.h> +#include <__type_traits/is_trivially_default_constructible.h> +#include <__type_traits/is_trivially_destructible.h> +#include <__type_traits/is_trivially_move_assignable.h> +#include <__type_traits/is_trivially_move_constructible.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/negation.h> #include <__type_traits/rank.h> #include <__type_traits/remove_all_extents.h> #include <__type_traits/remove_const.h> @@ -473,6 +513,8 @@ namespace std #include <__type_traits/remove_reference.h> #include <__type_traits/remove_volatile.h> #include <__type_traits/type_identity.h> +#include <__type_traits/underlying_type.h> +#include <__type_traits/void_t.h> #include <__utility/declval.h> #include <cstddef> #include <version> @@ -480,44 +522,35 @@ namespace std #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning(push) -#pragma warning(disable: 4296) -#endif _LIBCPP_BEGIN_NAMESPACE_STD template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; +// CUDA headers use libc++ internals. +#ifdef __CUDACC__ +template <bool _Cond, class _Ret = void> +using __lazy_enable_if _LIBCPP_NODEBUG = __enable_if_t<_Cond, _Ret>; +#endif + template <bool> struct _MetaBase; template <> struct _MetaBase<true> { - template <class _Tp, class _Up> - using _SelectImpl _LIBCPP_NODEBUG = _Tp; template <template <class...> class _FirstFn, template <class...> class, class ..._Args> using _SelectApplyImpl _LIBCPP_NODEBUG = _FirstFn<_Args...>; template <class _First, class...> using _FirstImpl _LIBCPP_NODEBUG = _First; template <class, class _Second, class...> using _SecondImpl _LIBCPP_NODEBUG = _Second; - template <class _Result, class _First, class ..._Rest> - using _OrImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>; - template <class _Result, class _First, class ..._Rest> - using _AndImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>; }; template <> struct _MetaBase<false> { - template <class _Tp, class _Up> - using _SelectImpl _LIBCPP_NODEBUG = _Up; template <template <class...> class, template <class...> class _SecondFn, class ..._Args> using _SelectApplyImpl _LIBCPP_NODEBUG = _SecondFn<_Args...>; - template <class _Result, class ...> - using _OrImpl _LIBCPP_NODEBUG = _Result; - template <class _Result, class ...> - using _AndImpl _LIBCPP_NODEBUG = _Result; }; + // Workaround for MSVC. Sometimes compiler thinks that sizeof...(Type) is parameter pack rather than the number. // So it doesn't allow sizeof...(Type) in expression that goes into the boolean template parameter of _MetaBase. // This simple wrapper allows us to hide sizeof... from the compiler. @@ -525,35 +558,11 @@ template<class... _Pack> struct _Sizeof { static constexpr size_t value = sizeof...(_Pack); }; -// CUDA headers use libc++ internals. -#ifdef __CUDACC__ -template <bool _Cond, class _Ret = void> -using __lazy_enable_if _LIBCPP_NODEBUG = __enable_if_t<_Cond, _Ret>; -#endif -template <bool _Cond, class _IfRes, class _ElseRes> -using _If _LIBCPP_NODEBUG = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>; -template <class ..._Rest> -using _Or _LIBCPP_NODEBUG = typename _MetaBase< _Sizeof<_Rest...>::value != 0 >::template _OrImpl<false_type, _Rest...>; -template <class _Pred> -struct _Not : _BoolConstant<!_Pred::value> {}; + template <class ..._Args> -using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(_Sizeof<_Args...>::value >= 1)>::template _FirstImpl<_Args...>; +using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>; template <class ..._Args> -using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(_Sizeof<_Args...>::value >= 2)>::template _SecondImpl<_Args...>; - -// fold-based implementation fails on multiple compilers. -#if 1 -template <class ..._Rest> -using _And _LIBCPP_NODEBUG = typename _MetaBase< _Sizeof<_Rest...>::value != 0 >::template _AndImpl<true_type, _Rest...>; -#else -template <class ...> using __expand_to_true = true_type; -template <class ..._Pred> -__expand_to_true<__enable_if_t<std::bool_constant<_Pred::value>::value>...> __and_helper(int); -template <class ...> -false_type __and_helper(...); -template <class ..._Pred> -using _And _LIBCPP_NODEBUG = decltype(__and_helper<std::bool_constant<_Pred::value>...>(0)); -#endif +using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>; template <template <class...> class _Func, class ..._Args> struct _Lazy : _Func<_Args...> {}; @@ -568,9 +577,6 @@ false_type __sfinae_test_impl(...); template <template <class ...> class _Templ, class ..._Args> using _IsValidExpansion _LIBCPP_NODEBUG = decltype(__sfinae_test_impl<_Templ, _Args...>(0)); -template <class> -struct __void_t { typedef void type; }; - template <class _Tp, bool> struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; @@ -636,27 +642,6 @@ struct remove_cvref { template <class _Tp> using remove_cvref_t = typename remove_cvref<_Tp>::type; #endif - -struct __any -{ - __any(...); -}; - -// __is_core_convertible - -// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed. -// We can't test for that, but we can test implicit convertibility by passing it -// to a function. Notice that __is_core_convertible<void,void> is false, -// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later. - -template <class _Tp, class _Up, class = void> -struct __is_core_convertible : public false_type {}; - -template <class _Tp, class _Up> -struct __is_core_convertible<_Tp, _Up, decltype( - static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() ) -)> : public true_type {}; - // is_nothrow_convertible #if _LIBCPP_STD_VER > 17 @@ -683,73 +668,6 @@ inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To #endif // _LIBCPP_STD_VER > 17 -// is_polymorphic - -#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_polymorphic - : public integral_constant<bool, __is_polymorphic(_Tp)> {}; - -#else - -template<typename _Tp> char &__is_polymorphic_impl( - typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, - int>::type); -template<typename _Tp> __two &__is_polymorphic_impl(...); - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_polymorphic - : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; - -#endif // __has_feature(is_polymorphic) - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; -#endif - -// has_virtual_destructor - -#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor - : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor - : public false_type {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; -#endif - -// has_unique_object_representations - -#if _LIBCPP_STD_VER > 14 - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations - : public integral_constant<bool, - __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {}; - -template <class _Tp> -inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; - -#endif - -// alignment_of - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of - : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; -#endif - // aligned_storage template <class _Hp, class _Tp> @@ -759,16 +677,6 @@ struct __type_list typedef _Tp _Tail; }; -struct __nat -{ -#ifndef _LIBCPP_CXX03_LANG - __nat() = delete; - __nat(const __nat&) = delete; - __nat& operator=(const __nat&) = delete; - ~__nat() = delete; -#endif -}; - template <class _Tp> struct __align_type { @@ -1046,55 +954,6 @@ struct __find_first<__type_list<_Hp, _Tp>, _Size, false> typedef _LIBCPP_NODEBUG typename __find_first<_Tp, _Size>::type type; }; -template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, - bool = is_volatile<typename remove_reference<_Tp>::type>::value> -struct __apply_cv -{ - typedef _LIBCPP_NODEBUG _Up type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp, _Up, true, false> -{ - typedef _LIBCPP_NODEBUG const _Up type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp, _Up, false, true> -{ - typedef volatile _Up type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp, _Up, true, true> -{ - typedef const volatile _Up type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp&, _Up, false, false> -{ - typedef _Up& type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp&, _Up, true, false> -{ - typedef const _Up& type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp&, _Up, false, true> -{ - typedef volatile _Up& type; -}; - -template <class _Tp, class _Up> -struct __apply_cv<_Tp&, _Up, true, true> -{ - typedef const volatile _Up& type; -}; - template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> struct __make_signed {}; @@ -1169,10 +1028,6 @@ typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept { } #endif -#if _LIBCPP_STD_VER > 14 -template <class...> using void_t = void; -#endif - #if _LIBCPP_STD_VER > 17 // Let COND_RES(X, Y) be: template <class _Tp, class _Up> @@ -1283,7 +1138,6 @@ struct _LIBCPP_TEMPLATE_VIS template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; #endif -#if _LIBCPP_STD_VER > 11 // Let COPYCV(FROM, TO) be an alias for type TO with the addition of FROM's // top-level cv-qualifiers. template <class _From, class _To> @@ -1295,19 +1149,19 @@ struct __copy_cv template <class _From, class _To> struct __copy_cv<const _From, _To> { - using type = add_const_t<_To>; + using type = typename add_const<_To>::type; }; template <class _From, class _To> struct __copy_cv<volatile _From, _To> { - using type = add_volatile_t<_To>; + using type = typename add_volatile<_To>::type; }; template <class _From, class _To> struct __copy_cv<const volatile _From, _To> { - using type = add_cv_t<_To>; + using type = typename add_cv<_To>::type; }; template <class _From, class _To> @@ -1322,19 +1176,18 @@ struct __copy_cvref template <class _From, class _To> struct __copy_cvref<_From&, _To> { - using type = add_lvalue_reference_t<__copy_cv_t<_From, _To>>; + using type = typename add_lvalue_reference<__copy_cv_t<_From, _To> >::type; }; template <class _From, class _To> struct __copy_cvref<_From&&, _To> { - using type = add_rvalue_reference_t<__copy_cv_t<_From, _To>>; + using type = typename add_rvalue_reference<__copy_cv_t<_From, _To> >::type; }; template <class _From, class _To> using __copy_cvref_t = typename __copy_cvref<_From, _To>::type; -#endif // _LIBCPP_STD_VER > 11 // common_reference #if _LIBCPP_STD_VER > 17 @@ -1493,403 +1346,6 @@ template <class...> struct common_reference {}; #endif // _LIBCPP_STD_VER > 17 -// is_assignable - -template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; - -#if __has_keyword(__is_assignable) - -template<class _Tp, class _Up> -struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Arg> -inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); -#endif - -#else // __has_keyword(__is_assignable) - -template <class _Tp, class _Arg> -typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type -__is_assignable_test(int); - -template <class, class> -false_type __is_assignable_test(...); - - -template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> -struct __is_assignable_imp - : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; - -template <class _Tp, class _Arg> -struct __is_assignable_imp<_Tp, _Arg, true> - : public false_type -{ -}; - -template <class _Tp, class _Arg> -struct is_assignable - : public __is_assignable_imp<_Tp, _Arg> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Arg> -inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; -#endif - -#endif // __has_keyword(__is_assignable) - -// is_copy_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable - : public is_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; -#endif - -// is_move_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable - : public is_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_rvalue_reference<_Tp>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; -#endif - -// is_destructible - -#if __has_keyword(__is_destructible) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_destructible_v = __is_destructible(_Tp); -#endif - -#else // __has_keyword(__is_destructible) - -// if it's a reference, return true -// if it's a function, return false -// if it's void, return false -// if it's an array of unknown bound, return false -// Otherwise, return "declval<_Up&>().~_Up()" is well-formed -// where _Up is remove_all_extents<_Tp>::type - -template <class> -struct __is_destructible_apply { typedef int type; }; - -template <typename _Tp> -struct __is_destructor_wellformed { - template <typename _Tp1> - static char __test ( - typename __is_destructible_apply<decltype(declval<_Tp1&>().~_Tp1())>::type - ); - - template <typename _Tp1> - static __two __test (...); - - static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); -}; - -template <class _Tp, bool> -struct __destructible_imp; - -template <class _Tp> -struct __destructible_imp<_Tp, false> - : public integral_constant<bool, - __is_destructor_wellformed<typename remove_all_extents<_Tp>::type>::value> {}; - -template <class _Tp> -struct __destructible_imp<_Tp, true> - : public true_type {}; - -template <class _Tp, bool> -struct __destructible_false; - -template <class _Tp> -struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, is_reference<_Tp>::value> {}; - -template <class _Tp> -struct __destructible_false<_Tp, true> : public false_type {}; - -template <class _Tp> -struct is_destructible - : public __destructible_false<_Tp, is_function<_Tp>::value> {}; - -template <class _Tp> -struct is_destructible<_Tp[]> - : public false_type {}; - -template <> -struct is_destructible<void> - : public false_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; -#endif - -#endif // __has_keyword(__is_destructible) - -template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> -struct __member_pointer_traits_imp -{ -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> -{ - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> -{ - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> -{ - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> -{ - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> -{ - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> -{ - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC) - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> -{ - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> -{ - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> -{ - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> -{ - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> -{ - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> -{ - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> -{ - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> -{ - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> -{ - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> -{ - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> -{ - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> -{ - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> -{ - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> -{ - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> -{ - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> -{ - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC) - - -template <class _Rp, class _Class> -struct __member_pointer_traits_imp<_Rp _Class::*, false, true> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; -}; - -template <class _MP> -struct __member_pointer_traits - : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, - is_member_function_pointer<_MP>::value, - is_member_object_pointer<_MP>::value> -{ -// typedef ... _ClassType; -// typedef ... _ReturnType; -// typedef ... _FnType; -}; - - -template <class _DecayedFp> -struct __member_pointer_class_type {}; - -template <class _Ret, class _ClassType> -struct __member_pointer_class_type<_Ret _ClassType::*> { - typedef _ClassType type; -}; - -// template <class T, class... Args> struct is_constructible; - -template <class _Tp, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_constructible - : public integral_constant<bool, __is_constructible(_Tp, _Args...)> -{ }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class ..._Args> -inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; -#endif - -// is_default_constructible - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_default_constructible - : public is_constructible<_Tp> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; -#endif - #ifndef _LIBCPP_CXX03_LANG // First of all, we can't implement this check in C++03 mode because the {} // default initialization syntax isn't valid. @@ -1914,646 +1370,6 @@ struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_defau { }; #endif // !C++03 -// is_copy_constructible - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_copy_constructible - : public is_constructible<_Tp, - typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; -#endif - -// is_move_constructible - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_move_constructible - : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; -#endif - -// is_trivially_constructible - -template <class _Tp, class... _Args> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible - : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> -{ -}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class... _Args> -inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; -#endif - -// is_trivially_default_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible - : public is_trivially_constructible<_Tp> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; -#endif - -// is_trivially_copy_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible - : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; -#endif - -// is_trivially_move_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible - : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; -#endif - -// is_trivially_assignable - -template <class _Tp, class _Arg> -struct is_trivially_assignable - : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> -{ }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Arg> -inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; -#endif - -// is_trivially_copy_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable - : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; -#endif - -// is_trivially_move_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable - : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_rvalue_reference<_Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; -#endif - -// is_trivially_destructible - -#if __has_keyword(__is_trivially_destructible) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible - : public integral_constant<bool, __is_trivially_destructible(_Tp)> {}; - -#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible - : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; - -#else - -template <class _Tp> struct __libcpp_trivial_destructor - : public integral_constant<bool, is_scalar<_Tp>::value || - is_reference<_Tp>::value> {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible - : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]> - : public false_type {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; -#endif - -// is_nothrow_constructible - -#if __has_keyword(__is_nothrow_constructible) - -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(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(_VSTD::__implicit_conversion_to<_Tp>(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 // _LIBCPP_HAS_NO_NOEXCEPT - - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class ..._Args> -inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; -#endif - -// is_nothrow_default_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible - : public is_nothrow_constructible<_Tp> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; -#endif - -// is_nothrow_copy_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible - : public is_nothrow_constructible<_Tp, - typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; -#endif - -// is_nothrow_move_constructible - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible - : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; -#endif - -// is_nothrow_assignable - -#if __has_keyword(__is_nothrow_assignable) - -template <class _Tp, class _Arg> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable - : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; - -#else - -template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; - -template <class _Tp, class _Arg> -struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> - : public false_type -{ -}; - -template <class _Tp, class _Arg> -struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> - : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Arg>()) > -{ -}; - -template <class _Tp, class _Arg> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable - : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> -{ -}; - -#endif // _LIBCPP_HAS_NO_NOEXCEPT - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Arg> -inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; -#endif - -// is_nothrow_copy_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable - : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; -#endif - -// is_nothrow_move_assignable - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable - : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, - typename add_rvalue_reference<_Tp>::type> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; -#endif - -// is_nothrow_destructible - -#if !defined(_LIBCPP_CXX03_LANG) - -template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; - -template <class _Tp> -struct __libcpp_is_nothrow_destructible<false, _Tp> - : public false_type -{ -}; - -template <class _Tp> -struct __libcpp_is_nothrow_destructible<true, _Tp> - : public integral_constant<bool, noexcept(declval<_Tp>().~_Tp()) > -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible - : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> -{ -}; - -template <class _Tp, size_t _Ns> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[_Ns]> - : public is_nothrow_destructible<_Tp> -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&> - : public true_type -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> - : public true_type -{ -}; - -#else - -template <class _Tp> struct __libcpp_nothrow_destructor - : public integral_constant<bool, is_scalar<_Tp>::value || - is_reference<_Tp>::value> {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible - : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> - : public false_type {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; -#endif - -// is_pod - -#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod - : public integral_constant<bool, __is_pod(_Tp)> {}; - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod - : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && - is_trivially_copy_constructible<_Tp>::value && - is_trivially_copy_assignable<_Tp>::value && - is_trivially_destructible<_Tp>::value> {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_pod_v = is_pod<_Tp>::value; -#endif - -// is_literal_type; - -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type - : public integral_constant<bool, __is_literal_type(_Tp)> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) - -// is_standard_layout; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout -#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) - : public integral_constant<bool, __is_standard_layout(_Tp)> -#else - : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> -#endif - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; -#endif - -// is_trivially_copyable; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable - : public integral_constant<bool, __is_trivially_copyable(_Tp)> - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; -#endif - -// is_trivial; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial -#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) - : public integral_constant<bool, __is_trivial(_Tp)> -#else - : integral_constant<bool, is_trivially_copyable<_Tp>::value && - is_trivially_default_constructible<_Tp>::value> -#endif - {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; -#endif - - -#ifndef _LIBCPP_CXX03_LANG - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet1 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet2 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet3 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet4 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet5 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet6 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -// __invoke forward declarations - -// fall back - none of the bullets - -template <class ..._Args> -auto __invoke(__any, _Args&& ...__args) -> __nat; - -// bullets 1, 2 and 3 - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet1<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) - { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet2<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...)) - { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet3<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) - { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } - -// bullets 4, 5 and 6 - -template <class _Fp, class _A0, - class = __enable_if_bullet4<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) - -> decltype( static_cast<_A0&&>(__a0).*__f) - { return static_cast<_A0&&>(__a0).*__f; } - -template <class _Fp, class _A0, - class = __enable_if_bullet5<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept(__a0.get().*__f)) - -> decltype( __a0.get().*__f) - { return __a0.get().*__f; } - -template <class _Fp, class _A0, - class = __enable_if_bullet6<_Fp, _A0>> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) - -> decltype( (*static_cast<_A0&&>(__a0)).*__f) - { return (*static_cast<_A0&&>(__a0)).*__f; } - -// bullet 7 - -template <class _Fp, class ..._Args> -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _Args&& ...__args) - noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) - -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) - { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } - -// __invokable -template <class _Ret, class _Fp, class ..._Args> -struct __invokable_r -{ - template <class _XFp, class ..._XArgs> - static auto __try_call(int) -> decltype( - _VSTD::__invoke(declval<_XFp>(), declval<_XArgs>()...)); - template <class _XFp, class ..._XArgs> - static __nat __try_call(...); - - // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, - // or incomplete array types as required by the standard. - using _Result = decltype(__try_call<_Fp, _Args...>(0)); - - using type = typename conditional< - _IsNotSame<_Result, __nat>::value, - typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type, - false_type >::type; - static const bool value = type::value; -}; -template <class _Fp, class ..._Args> -using __invokable = __invokable_r<void, _Fp, _Args...>; - -template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp { - static const bool value = false; -}; - -template <class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> -{ - typedef __nothrow_invokable_r_imp _ThisT; - - template <class _Tp> - static void __test_noexcept(_Tp) noexcept; - - static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( - _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...))); -}; - -template <class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> -{ - static const bool value = noexcept( - _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)); -}; - -template <class _Ret, class _Fp, class ..._Args> -using __nothrow_invokable_r = - __nothrow_invokable_r_imp< - __invokable_r<_Ret, _Fp, _Args...>::value, - is_void<_Ret>::value, - _Ret, _Fp, _Args... - >; - -template <class _Fp, class ..._Args> -using __nothrow_invokable = - __nothrow_invokable_r_imp< - __invokable<_Fp, _Args...>::value, - true, void, _Fp, _Args... - >; - -template <class _Fp, class ..._Args> -struct __invoke_of - : public enable_if< - __invokable<_Fp, _Args...>::value, - typename __invokable_r<void, _Fp, _Args...>::_Result> -{ -}; - -#else - -// Assume that it's a functor in C++03 -template <class _Func, class... _Args> -_LIBCPP_HIDE_FROM_ABI -decltype(std::declval<_Func>()(std::declval<_Args>()...)) __invoke(_Func&& __func, _Args&&... __args) { - return static_cast<_Func&&>(__func)(static_cast<_Args&&>(__args)...); -} - -#endif // _LIBCPP_CXX03_LANG - // result_of #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) @@ -2649,53 +1465,6 @@ template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename re #endif // _LIBCPP_STD_VER > 11 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) -#if _LIBCPP_STD_VER > 14 - -// invoke_result - -template <class _Fn, class... _Args> -struct _LIBCPP_TEMPLATE_VIS invoke_result - : __invoke_of<_Fn, _Args...> -{ -}; - -template <class _Fn, class... _Args> -using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; - -// is_invocable - -template <class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_invocable - : integral_constant<bool, __invokable<_Fn, _Args...>::value> {}; - -template <class _Ret, class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_invocable_r - : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; - -template <class _Fn, class ..._Args> -inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; - -template <class _Ret, class _Fn, class ..._Args> -inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; - -// is_nothrow_invocable - -template <class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable - : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {}; - -template <class _Ret, class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r - : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {}; - -template <class _Fn, class ..._Args> -inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; - -template <class _Ret, class _Fn, class ..._Args> -inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; - -#endif // _LIBCPP_STD_VER > 14 - // __swappable template <class _Tp> struct __is_swappable; @@ -2828,24 +1597,6 @@ inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; #endif // _LIBCPP_STD_VER > 14 -template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl; - -template <class _Tp> -struct __underlying_type_impl<_Tp, false> {}; - -template <class _Tp> -struct __underlying_type_impl<_Tp, true> -{ - typedef __underlying_type(_Tp) type; -}; - -template <class _Tp> -struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; -#endif - template <class _Tp, bool = is_enum<_Tp>::value> struct __sfinae_underlying_type { @@ -2892,42 +1643,6 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename __sfinae_underlying_type<_Tp>::__promoted_type __convert_to_integral(_Tp __val) { return __val; } -// is_scoped_enum [meta.unary.prop] - -#if _LIBCPP_STD_VER > 20 -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 - -#if _LIBCPP_STD_VER > 14 - -template <class... _Args> -struct conjunction : _And<_Args...> {}; -template<class... _Args> -inline constexpr bool conjunction_v = conjunction<_Args...>::value; - -template <class... _Args> -struct disjunction : _Or<_Args...> {}; -template<class... _Args> -inline constexpr bool disjunction_v = disjunction<_Args...>::value; - -template <class _Tp> -struct negation : _Not<_Tp> {}; -template<class _Tp> -inline constexpr bool negation_v = negation<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 - // These traits are used in __tree and __hash_table struct __extract_key_fail_tag {}; struct __extract_key_self_tag {}; @@ -2958,31 +1673,14 @@ template <class _ValTy, class _Key, class _RawValTy> struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {}; -#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED -#if _LIBCPP_STD_VER > 17 -_LIBCPP_INLINE_VISIBILITY -inline constexpr bool is_constant_evaluated() noexcept { - return __builtin_is_constant_evaluated(); -} -#endif - -inline _LIBCPP_CONSTEXPR -bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } -#else -inline _LIBCPP_CONSTEXPR -bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; } -#endif - template <class _CharT> using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; template<class _Tp> using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&; -#if _LIBCPP_STD_VER > 17 template<bool _Const, class _Tp> -using __maybe_const = conditional_t<_Const, const _Tp, _Tp>; -#endif // _LIBCPP_STD_VER > 17 +using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/typeindex b/contrib/libs/cxxsupp/libcxx/include/typeindex index 8da8f58c53..a92375ab75 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeindex +++ b/contrib/libs/cxxsupp/libcxx/include/typeindex @@ -51,11 +51,6 @@ struct hash<type_index> #include <typeinfo> #include <version> -// TODO: remove these headers -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <new> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index 16b843b944..4fc068d6e6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -521,12 +521,14 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__functional/is_transparent.h> #include <__functional/operations.h> #include <__hash_table> +#include <__iterator/distance.h> +#include <__iterator/erase_if_container.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> #include <compare> -#include <iterator> // __libcpp_erase_if_container +#include <iterator> // TODO: Remove this include #include <stdexcept> #include <tuple> #include <version> @@ -1512,7 +1514,7 @@ public: _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n) {__table_.reserve(__n);} -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} @@ -1523,7 +1525,7 @@ public: bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: @@ -2288,7 +2290,7 @@ public: _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n) {__table_.reserve(__n);} -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} @@ -2299,7 +2301,7 @@ public: bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE }; diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index 890475f36f..48c6ff48df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -466,11 +466,14 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__functional/is_transparent.h> #include <__functional/operations.h> #include <__hash_table> +#include <__iterator/distance.h> +#include <__iterator/erase_if_container.h> +#include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include <__node_handle> #include <__utility/forward.h> #include <compare> -#include <iterator> // __libcpp_erase_if_container +#include <iterator> // TODO: Remove this include #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -843,7 +846,7 @@ public: _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n) {__table_.reserve(__n);} -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const {return __table_.__dereferenceable(__i);} @@ -854,7 +857,7 @@ public: bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const {return __table_.__addable(__i, __n);} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE }; @@ -1481,7 +1484,7 @@ public: _LIBCPP_INLINE_VISIBILITY void reserve(size_type __n) {__table_.reserve(__n);} -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const {return __table_.__dereferenceable(__i);} @@ -1492,7 +1495,7 @@ public: bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const {return __table_.__addable(__i, __n);} -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE }; diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index bcd4abfcd1..9fa867f96c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -242,6 +242,7 @@ template <class T> #include <__utility/unreachable.h> #include <compare> #include <initializer_list> +#include <type_traits> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/valarray b/contrib/libs/cxxsupp/libcxx/include/valarray index bae7bc41d4..300298a1bf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/valarray +++ b/contrib/libs/cxxsupp/libcxx/include/valarray @@ -923,10 +923,14 @@ public: #endif // _LIBCPP_CXX03_LANG // unary operators: - valarray operator+() const; - valarray operator-() const; - valarray operator~() const; - valarray<bool> operator!() const; + _LIBCPP_INLINE_VISIBILITY + __val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray&> > operator+() const; + _LIBCPP_INLINE_VISIBILITY + __val_expr<_UnaryOp<negate<_Tp>, const valarray&> > operator-() const; + _LIBCPP_INLINE_VISIBILITY + __val_expr<_UnaryOp<__bit_not<_Tp>, const valarray&> > operator~() const; + _LIBCPP_INLINE_VISIBILITY + __val_expr<_UnaryOp<logical_not<_Tp>, const valarray&> > operator!() const; // computed assignment: _LIBCPP_INLINE_VISIBILITY @@ -1100,7 +1104,7 @@ template<class _Tp, size_t _Size> valarray(const _Tp(&)[_Size], size_t) -> valarray<_Tp>; #endif -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t)) +extern template _LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t); template <class _Op, class _Tp> struct _UnaryOp<_Op, valarray<_Tp> > @@ -3300,63 +3304,39 @@ valarray<_Tp>::operator[](valarray<size_t>&& __vs) #endif // _LIBCPP_CXX03_LANG template <class _Tp> -valarray<_Tp> +inline +__val_expr<_UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator+() const { - valarray<value_type> __r; - size_t __n = size(); - if (__n) - { - __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); - for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new ((void*)__r.__end_) value_type(+*__p); - } - return __r; + using _Op = _UnaryOp<__unary_plus<_Tp>, const valarray<_Tp>&>; + return __val_expr<_Op>(_Op(__unary_plus<_Tp>(), *this)); } template <class _Tp> -valarray<_Tp> +inline +__val_expr<_UnaryOp<negate<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator-() const { - valarray<value_type> __r; - size_t __n = size(); - if (__n) - { - __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); - for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new ((void*)__r.__end_) value_type(-*__p); - } - return __r; + using _Op = _UnaryOp<negate<_Tp>, const valarray<_Tp>&>; + return __val_expr<_Op>(_Op(negate<_Tp>(), *this)); } template <class _Tp> -valarray<_Tp> +inline +__val_expr<_UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator~() const { - valarray<value_type> __r; - size_t __n = size(); - if (__n) - { - __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); - for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new ((void*)__r.__end_) value_type(~*__p); - } - return __r; + using _Op = _UnaryOp<__bit_not<_Tp>, const valarray<_Tp>&>; + return __val_expr<_Op>(_Op(__bit_not<_Tp>(), *this)); } template <class _Tp> -valarray<bool> +inline +__val_expr<_UnaryOp<logical_not<_Tp>, const valarray<_Tp>&> > valarray<_Tp>::operator!() const { - valarray<bool> __r; - size_t __n = size(); - if (__n) - { - __r.__begin_ = __r.__end_ = allocator<bool>().allocate(__n); - for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new ((void*)__r.__end_) bool(!*__p); - } - return __r; + using _Op = _UnaryOp<logical_not<_Tp>, const valarray<_Tp>&>; + return __val_expr<_Op>(_Op(logical_not<_Tp>(), *this)); } template <class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index eaff498586..eb120c18e7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -220,11 +220,6 @@ namespace std { #include <type_traits> #include <version> -// TODO: remove these headers -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <typeinfo> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 14146c86a0..79b40ed666 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -286,7 +286,9 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <__format/enable_insertable.h> #include <__functional/hash.h> #include <__functional/unary_function.h> +#include <__iterator/advance.h> #include <__iterator/iterator_traits.h> +#include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> #include <__memory/allocate_at_least.h> #include <__split_buffer> @@ -305,9 +307,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <type_traits> #include <version> -// TODO: remove these headers -#include <typeinfo> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -643,14 +642,14 @@ public: bool __invariants() const; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE private: pointer __begin_ = nullptr; @@ -1388,15 +1387,17 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) std::__debug_db_invalidate_all(this); } +// 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> inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(this, __p); -#else +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 return iterator(__p); +#else + return iterator(this, __p); #endif } @@ -1405,10 +1406,10 @@ inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 - return const_iterator(this, __p); -#else +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1 return const_iterator(__p); +#else + return const_iterator(this, __p); #endif } @@ -1831,7 +1832,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs } __p = _VSTD::rotate(__p, __old_last, this->__end_); insert(__make_iter(__p), _VSTD::make_move_iterator(__v.begin()), - _VSTD::make_move_iterator(__v.end())); + _VSTD::make_move_iterator(__v.end())); return begin() + __off; } @@ -1884,45 +1885,45 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi return __make_iter(__p); } -#if _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED - template <class _Tp, class _Allocator> void -vector<_Tp, _Allocator>::resize_uninitialized(size_type __sz) +vector<_Tp, _Allocator>::resize(size_type __sz) { size_type __cs = size(); if (__cs < __sz) - this->__append_uninitialized(__sz - __cs); - else if (__cs > __sz) { - this->__end_ = this->__begin_ + __sz; - __annotate_shrink(__cs); - } + this->__append(__sz - __cs); + else if (__cs > __sz) + this->__destruct_at_end(this->__begin_ + __sz); } -#endif - template <class _Tp, class _Allocator> void -vector<_Tp, _Allocator>::resize(size_type __sz) +vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) { size_type __cs = size(); if (__cs < __sz) - this->__append(__sz - __cs); + this->__append(__sz - __cs, __x); else if (__cs > __sz) this->__destruct_at_end(this->__begin_ + __sz); } +#if _YNDX_LIBCXX_ENABLE_VECTOR_POD_RESIZE_UNINITIALIZED + template <class _Tp, class _Allocator> void -vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) +vector<_Tp, _Allocator>::resize_uninitialized(size_type __sz) { size_type __cs = size(); if (__cs < __sz) - this->__append(__sz - __cs, __x); - else if (__cs > __sz) - this->__destruct_at_end(this->__begin_ + __sz); + this->__append_uninitialized(__sz - __cs); + else if (__cs > __sz) { + this->__end_ = this->__begin_ + __sz; + __annotate_shrink(__cs); + } } +#endif + template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::swap(vector& __x) @@ -1966,7 +1967,7 @@ vector<_Tp, _Allocator>::__invariants() const return true; } -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE template <class _Tp, class _Allocator> bool @@ -1998,13 +1999,13 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __ return this->__begin_ <= __p && __p < this->__end_; } -#endif // _LIBCPP_DEBUG_LEVEL == 2 +#endif // _LIBCPP_ENABLE_DEBUG_MODE template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { --__p; diff --git a/contrib/libs/cxxsupp/libcxx/src/charconv.cpp b/contrib/libs/cxxsupp/libcxx/src/charconv.cpp index 9537b42de7..63da85b093 100644 --- a/contrib/libs/cxxsupp/libcxx/src/charconv.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/charconv.cpp @@ -9,141 +9,31 @@ #include <charconv> #include <string.h> -#include "include/ryu/digit_table.h" #include "include/to_chars_floating_point.h" _LIBCPP_BEGIN_NAMESPACE_STD -namespace __itoa -{ - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append1(char* buffer, T i) noexcept -{ - *buffer = '0' + static_cast<char>(i); - return buffer + 1; -} - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append2(char* buffer, T i) noexcept -{ - memcpy(buffer, &__DIGIT_TABLE[(i)*2], 2); - return buffer + 2; -} - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append3(char* buffer, T i) noexcept -{ - return append2(append1(buffer, (i) / 100), (i) % 100); -} +#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append4(char* buffer, T i) noexcept -{ - return append2(append2(buffer, (i) / 100), (i) % 100); -} - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append2_no_zeros(char* buffer, T v) noexcept -{ - if (v < 10) - return append1(buffer, v); - else - return append2(buffer, v); -} - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append4_no_zeros(char* buffer, T v) noexcept -{ - if (v < 100) - return append2_no_zeros(buffer, v); - else if (v < 1000) - return append3(buffer, v); - else - return append4(buffer, v); -} - -template <typename T> -inline _LIBCPP_INLINE_VISIBILITY char* -append8_no_zeros(char* buffer, T v) noexcept +namespace __itoa { - if (v < 10000) - { - buffer = append4_no_zeros(buffer, v); - } - else - { - buffer = append4_no_zeros(buffer, v / 10000); - buffer = append4(buffer, v % 10000); - } - return buffer; -} -char* +_LIBCPP_FUNC_VIS char* __u32toa(uint32_t value, char* buffer) noexcept { - if (value < 100000000) - { - buffer = append8_no_zeros(buffer, value); - } - else - { - // value = aabbbbcccc in decimal - const uint32_t a = value / 100000000; // 1 to 42 - value %= 100000000; - - buffer = append2_no_zeros(buffer, a); - buffer = append4(buffer, value / 10000); - buffer = append4(buffer, value % 10000); - } - - return buffer; + return __base_10_u32(value, buffer); } -char* +_LIBCPP_FUNC_VIS char* __u64toa(uint64_t value, char* buffer) noexcept { - if (value < 100000000) - { - uint32_t v = static_cast<uint32_t>(value); - buffer = append8_no_zeros(buffer, v); - } - else if (value < 10000000000000000) - { - const uint32_t v0 = static_cast<uint32_t>(value / 100000000); - const uint32_t v1 = static_cast<uint32_t>(value % 100000000); - - buffer = append8_no_zeros(buffer, v0); - buffer = append4(buffer, v1 / 10000); - buffer = append4(buffer, v1 % 10000); - } - else - { - const uint32_t a = - static_cast<uint32_t>(value / 10000000000000000); // 1 to 1844 - value %= 10000000000000000; - - buffer = append4_no_zeros(buffer, a); - - const uint32_t v0 = static_cast<uint32_t>(value / 100000000); - const uint32_t v1 = static_cast<uint32_t>(value % 100000000); - buffer = append4(buffer, v0 / 10000); - buffer = append4(buffer, v0 % 10000); - buffer = append4(buffer, v1 / 10000); - buffer = append4(buffer, v1 % 10000); - } - - return buffer; + return __base_10_u64(value, buffer); } } // namespace __itoa +#endif // _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 + // The original version of floating-point to_chars was written by Microsoft and // contributed with the following license. diff --git a/contrib/libs/cxxsupp/libcxx/src/include/ryu/digit_table.h b/contrib/libs/cxxsupp/libcxx/src/include/ryu/digit_table.h index e4ee94ce26..c57a0966ef 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/ryu/digit_table.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/ryu/digit_table.h @@ -39,30 +39,19 @@ #ifndef _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H #define _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H -// Avoid formatting to keep the changes with the original code minimal. -// clang-format off - +#include <__charconv/tables.h> #include <__config> _LIBCPP_BEGIN_NAMESPACE_STD // A table of all two-digit numbers. This is used to speed up decimal digit // generation by copying pairs of digits into the final output. -inline constexpr char __DIGIT_TABLE[200] = { - '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9', - '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9', - '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9', - '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9', - '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9', - '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9', - '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9', - '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9', - '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9', - '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9' -}; +// +// In order to minimize the diff in the Ryu code between MSVC STL and libc++ +// the code uses the name __DIGIT_TABLE. In order to avoid code duplication it +// reuses the table already available in libc++. +inline constexpr auto& __DIGIT_TABLE = __itoa::__table<>::__digits_base_10; _LIBCPP_END_NAMESPACE_STD -// clang-format on - #endif // _LIBCPP_SRC_INCLUDE_RYU_DIGIT_TABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h b/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h index 0bb45d0b97..b99d790f65 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/to_chars_floating_point.h @@ -23,6 +23,7 @@ #include <__algorithm/min.h> #include <__assert> #include <__config> +#include <__functional/operations.h> #include <__iterator/access.h> #include <__iterator/size.h> #include <bit> diff --git a/contrib/libs/cxxsupp/libcxx/src/memory.cpp b/contrib/libs/cxxsupp/libcxx/src/memory.cpp index e207e05e15..f805acbaf5 100644 --- a/contrib/libs/cxxsupp/libcxx/src/memory.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/memory.cpp @@ -170,12 +170,16 @@ __shared_weak_count::__get_deleter(const type_info&) const noexcept #if !defined(_LIBCPP_HAS_NO_THREADS) -static constexpr std::size_t __sp_mut_count = 16; +static constexpr std::size_t __sp_mut_count = 32; static _LIBCPP_CONSTINIT __libcpp_mutex_t mut_back[__sp_mut_count] = { _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, + _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER, _LIBCPP_MUTEX_INITIALIZER }; @@ -188,16 +192,7 @@ void __sp_mut::lock() noexcept { auto m = static_cast<__libcpp_mutex_t*>(__lx); - unsigned count = 0; - while (!__libcpp_mutex_trylock(m)) - { - if (++count > 16) - { - __libcpp_mutex_lock(m); - break; - } - this_thread::yield(); - } + __libcpp_mutex_lock(m); } void @@ -213,7 +208,11 @@ __get_sp_mut(const void* p) &mut_back[ 0], &mut_back[ 1], &mut_back[ 2], &mut_back[ 3], &mut_back[ 4], &mut_back[ 5], &mut_back[ 6], &mut_back[ 7], &mut_back[ 8], &mut_back[ 9], &mut_back[10], &mut_back[11], - &mut_back[12], &mut_back[13], &mut_back[14], &mut_back[15] + &mut_back[12], &mut_back[13], &mut_back[14], &mut_back[15], + &mut_back[16], &mut_back[17], &mut_back[18], &mut_back[19], + &mut_back[20], &mut_back[21], &mut_back[22], &mut_back[23], + &mut_back[24], &mut_back[25], &mut_back[26], &mut_back[27], + &mut_back[28], &mut_back[29], &mut_back[30], &mut_back[31] }; return muts[hash<const void*>()(p) & (__sp_mut_count-1)]; } diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index 04eedb0400..9e43be3294 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -13,9 +13,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2022-06-01) +VERSION(2022-06-14) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/10c4eec2785a68880c287d36c262d5be3a72a128.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/1cf4113952ae3e4cc75decdf6feb3ce5dd8ca4a1.tar.gz) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include |