diff options
117 files changed, 3804 insertions, 1846 deletions
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml index 6605bd33ed..3f472c3170 100644 --- a/build/sysincl/stl-to-libcxx.yml +++ b/build/sysincl/stl-to-libcxx.yml @@ -248,18 +248,25 @@ - __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_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_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 - __algorithm/ranges_copy_n.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_copy_n.h - __algorithm/ranges_count.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count.h - __algorithm/ranges_count_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_count_if.h + - __algorithm/ranges_equal.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h + - __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_if.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if.h - __algorithm/ranges_find_if_not.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_find_if_not.h - __algorithm/ranges_for_each.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each.h - __algorithm/ranges_for_each_n.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_for_each_n.h - __algorithm/ranges_is_partitioned.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_partitioned.h + - __algorithm/ranges_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_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 @@ -267,6 +274,8 @@ - __algorithm/ranges_minmax.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_minmax.h - __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_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/remove.h: contrib/libs/cxxsupp/libcxx/include/__algorithm/remove.h @@ -475,8 +484,61 @@ - __support/xlocale/__strtonum_fallback.h: contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h - __thread/poll_with_backoff.h: contrib/libs/cxxsupp/libcxx/include/__thread/poll_with_backoff.h - __thread/timed_backoff_policy.h: contrib/libs/cxxsupp/libcxx/include/__thread/timed_backoff_policy.h + - __type_traits/add_const.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_const.h + - __type_traits/add_cv.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_cv.h + - __type_traits/add_lvalue_reference.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/add_lvalue_reference.h + - __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/conditional.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h + - __type_traits/decay.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/decay.h + - __type_traits/enable_if.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/enable_if.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_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 - __type_traits/is_callable.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_callable.h + - __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_convertible.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_convertible.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 + - __type_traits/is_floating_point.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/is_floating_point.h + - __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_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_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_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_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_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_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/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 + - __type_traits/remove_cv.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h + - __type_traits/remove_extent.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h + - __type_traits/remove_pointer.h: contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_pointer.h + - __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 - __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 diff --git a/build/ymake.core.conf b/build/ymake.core.conf index e25997550f..2ceffde021 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-18 +CPP_FAKEID=2023-10-24 GO_FAKEID=11100371 ANDROID_FAKEID=2023-05-17 CLANG_TIDY_FAKEID=2023-06-06 diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h new file mode 100644 index 0000000000..a146865652 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_all_of.h @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// 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_ALL_OF_H +#define _LIBCPP___ALGORITHM_RANGES_ALL_OF_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 <__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 __all_of { +struct __fn { + + template <class _Iter, class _Sent, class _Proj, class _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr static + bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { + for (; __first != __last; ++__first) { + if (!std::invoke(__pred, std::invoke(__proj, *__first))) + return false; + } + return true; + } + + template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const { + return __all_of_impl(std::move(__first), std::move(__last), __pred, __proj); + } + + template <input_range _Range, class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { + return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); + } +}; +} // namespace __all_of + +inline namespace __cpo { + inline constexpr auto all_of = __all_of::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h new file mode 100644 index 0000000000..11c52cbe21 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_any_of.h @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// 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_ANY_OF_H +#define _LIBCPP___ALGORITHM_RANGES_ANY_OF_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 <__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 __any_of { +struct __fn { + + template <class _Iter, class _Sent, class _Proj, class _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr static + bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { + for (; __first != __last; ++__first) { + if (std::invoke(__pred, std::invoke(__proj, *__first))) + return true; + } + return false; + } + + template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { + return __any_of_impl(std::move(__first), std::move(__last), __pred, __proj); + } + + template <input_range _Range, class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { + return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); + } +}; +} // namespace __any_of + +inline namespace __cpo { + inline constexpr auto any_of = __any_of::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h new file mode 100644 index 0000000000..c5f2d23322 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_equal.h @@ -0,0 +1,115 @@ +//===----------------------------------------------------------------------===// +// +// 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_EQUAL_H +#define _LIBCPP___ALGORITHM_RANGES_EQUAL_H + +#include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> +#include <__functional/ranges_operations.h> +#include <__iterator/concepts.h> +#include <__iterator/distance.h> +#include <__iterator/indirectly_comparable.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __equal { +struct __fn { +private: + template <class _Iter1, class _Sent1, + class _Iter2, class _Sent2, + class _Pred, + class _Proj1, + class _Proj2> + _LIBCPP_HIDE_FROM_ABI constexpr static + bool __equal_impl(_Iter1 __first1, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Pred& __pred, + _Proj1& __proj1, + _Proj2& __proj2) { + while (__first1 != __last1 && __first2 != __last2) { + if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) + return false; + ++__first1; + ++__first2; + } + return __first1 == __last1 && __first2 == __last2; + } + +public: + + template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, + input_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 + bool operator()(_Iter1 __first1, _Sent1 __last1, + _Iter2 __first2, _Sent2 __last2, + _Pred __pred = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) const { + if constexpr (sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>) { + if (__last1 - __first1 != __last2 - __first2) + return false; + } + return __equal_impl(std::move(__first1), std::move(__last1), + std::move(__first2), std::move(__last2), + __pred, + __proj1, + __proj2); + } + + template <input_range _Range1, + input_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 + bool operator()(_Range1&& __range1, + _Range2&& __range2, + _Pred __pred = {}, + _Proj1 __proj1 = {}, + _Proj2 __proj2 = {}) const { + if constexpr (sized_range<_Range1> && sized_range<_Range2>) { + if (ranges::distance(__range1) != ranges::distance(__range2)) + return false; + } + return __equal_impl(ranges::begin(__range1), ranges::end(__range1), + ranges::begin(__range2), ranges::end(__range2), + __pred, + __proj1, + __proj2); + return false; + } +}; +} // namespace __equal + +inline namespace __cpo { + inline constexpr auto equal = __equal::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.h new file mode 100644 index 0000000000..846e318851 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill.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___ALGORITHM_RANGES_FILL_H +#define _LIBCPP___ALGORITHM_RANGES_FILL_H + +#include <__algorithm/ranges_fill_n.h> +#include <__config> +#include <__iterator/concepts.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 __fill { +struct __fn { + template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const { + if constexpr(random_access_iterator<_Iter>) { + return ranges::fill_n(__first, __last - __first, __value); + } else { + for (; __first != __last; ++__first) + *__first = __value; + return __first; + } + } + + template <class _Type, output_range<const _Type&> _Range> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const { + return (*this)(ranges::begin(__range), ranges::end(__range), __value); + } +}; +} // namespace __fill + +inline namespace __cpo { + inline constexpr auto fill = __fill::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_FILL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h new file mode 100644 index 0000000000..d93c573406 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_fill_n.h @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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_FILL_N_H +#define _LIBCPP___ALGORITHM_RANGES_FILL_N_H + +#include <__config> +#include <__iterator/concepts.h> +#include <__iterator/incrementable_traits.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 __fill_n { +struct __fn { + template <class _Type, output_iterator<const _Type&> _Iter> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, iter_difference_t<_Iter> __n, const _Type& __value) const { + for (; __n != 0; --__n) { + *__first = __value; + ++__first; + } + return __first; + } +}; +} // namespace __fill_n + +inline namespace __cpo { + inline constexpr auto fill_n = __fill_n::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h new file mode 100644 index 0000000000..938e69afba --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted.h @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H +#define _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H + +#include <__algorithm/ranges_is_sorted_until.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 <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace ranges { +namespace __is_sorted { +struct __fn { + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, + class _Proj = identity, + indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { + return ranges::__is_sorted_until_impl(std::move(__first), __last, __comp, __proj) == __last; + } + + template <forward_range _Range, + class _Proj = identity, + indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { + auto __last = ranges::end(__range); + return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last; + } +}; +} // namespace __is_sorted + +inline namespace __cpo { + inline constexpr auto is_sorted = __is_sorted::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.h new file mode 100644 index 0000000000..c8f0608e12 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_is_sorted_until.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__ALGORITHM_RANGES_IS_SORTED_UNTIL_H +#define _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_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 { + +template <class _Iter, class _Sent, class _Proj, class _Comp> +_LIBCPP_HIDE_FROM_ABI constexpr +_Iter __is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) { + if (__first == __last) + return __first; + auto __i = __first; + while (++__i != __last) { + if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first))) + return __i; + __first = __i; + } + return __i; +} + +namespace __is_sorted_until { +struct __fn { + template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, + class _Proj = identity, + indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const { + return ranges::__is_sorted_until_impl(std::move(__first), std::move(__last), __comp, __proj); + } + + template <forward_range _Range, + class _Proj = identity, + indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const { + return ranges::__is_sorted_until_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj); + } +}; +} // namespace __is_sorted_until + +inline namespace __cpo { + inline constexpr auto is_sorted_until = __is_sorted_until::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h index 2ec464a52d..d8d7242e17 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_max_element.h @@ -36,7 +36,7 @@ struct __fn { _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const { auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; - return __min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj); + return ranges::__min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj); } template <forward_range _Rp, class _Proj = identity, @@ -44,7 +44,7 @@ struct __fn { _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; - return __min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj); + return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj); } }; } // namespace __max_element diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h new file mode 100644 index 0000000000..706ff5cd74 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_none_of.h @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// 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_NONE_OF_H +#define _LIBCPP___ALGORITHM_RANGES_NONE_OF_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 <__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 __none_of { +struct __fn { + + template <class _Iter, class _Sent, class _Proj, class _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr static + bool __none_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) { + for (; __first != __last; ++__first) { + if (std::invoke(__pred, std::invoke(__proj, *__first))) + return false; + } + return true; + } + + template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity, + indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const { + return __none_of_impl(std::move(__first), std::move(__last), __pred, __proj); + } + + template <input_range _Range, class _Proj = identity, + indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred> + _LIBCPP_HIDE_FROM_ABI constexpr + bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const { + return __none_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); + } +}; +} // namespace __none_of + +inline namespace __cpo { + inline constexpr auto none_of = __none_of::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_NONE_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h new file mode 100644 index 0000000000..e7555d0f9a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/ranges_reverse.h @@ -0,0 +1,83 @@ +//===----------------------------------------------------------------------===// +// +// 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_REVERSE_H +#define _LIBCPP___ALGORITHM_RANGES_REVERSE_H + +#include <__config> +#include <__iterator/concepts.h> +#include <__iterator/iter_swap.h> +#include <__iterator/next.h> +#include <__iterator/permutable.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 __reverse { +struct __fn { + + template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent> + requires permutable<_Iter> + _LIBCPP_HIDE_FROM_ABI constexpr + _Iter operator()(_Iter __first, _Sent __last) const { + if constexpr (random_access_iterator<_Iter>) { + if (__first == __last) + return __first; + + auto __end = ranges::next(__first, __last); + auto __ret = __end; + + while (__first < --__end) { + ranges::iter_swap(__first, __end); + ++__first; + } + return __ret; + } else { + auto __end = ranges::next(__first, __last); + auto __ret = __end; + + while (__first != __end) { + if (__first == --__end) + break; + + ranges::iter_swap(__first, __end); + ++__first; + } + return __ret; + } + } + + template <bidirectional_range _Range> + requires permutable<iterator_t<_Range>> + _LIBCPP_HIDE_FROM_ABI constexpr + borrowed_iterator_t<_Range> operator()(_Range&& __range) const { + return (*this)(ranges::begin(__range), ranges::end(__range)); + } + +}; +} // namespace __reverse + +inline namespace __cpo { + inline constexpr auto reverse = __reverse::__fn{}; +} // namespace __cpo +} // namespace ranges + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + +#endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h index d108dc31bd..b5eaf75055 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sort.h @@ -14,8 +14,11 @@ #include <__algorithm/min_element.h> #include <__algorithm/partial_sort.h> #include <__algorithm/unwrap_iter.h> +#include <__bits> #include <__config> +#include <__functional/operations.h> #include <__utility/swap.h> +#include <climits> #include <memory> #if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY) @@ -498,6 +501,15 @@ void __introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _C template <typename _Number> inline _LIBCPP_HIDE_FROM_ABI _Number __log2i(_Number __n) { + if (__n == 0) + return 0; + if (sizeof(__n) <= sizeof(unsigned)) + return sizeof(unsigned) * CHAR_BIT - 1 - __libcpp_clz(static_cast<unsigned>(__n)); + if (sizeof(__n) <= sizeof(unsigned long)) + return sizeof(unsigned long) * CHAR_BIT - 1 - __libcpp_clz(static_cast<unsigned long>(__n)); + if (sizeof(__n) <= sizeof(unsigned long long)) + return sizeof(unsigned long long) * CHAR_BIT - 1 - __libcpp_clz(static_cast<unsigned long long>(__n)); + _Number __log2 = 0; while (__n > 1) { __log2++; diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index 3e1a53e6e6..12b2b97dd0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -141,9 +141,9 @@ // compatible. This switch removes these workarounds for platforms that don't care // about ABI compatibility. # define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT -// Remove basic_string common base +// Don't export the legacy __basic_string_common class and its methods from the built library. # define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON -// Remove vector base class +// Don't export the legacy __vector_base_common class and its methods from the built library. # 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 @@ -370,7 +370,7 @@ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) # define _LIBCPP_USING_ARC4_RANDOM -#elif defined(__wasi__) +#elif defined(__wasi__) || defined(__EMSCRIPTEN__) # define _LIBCPP_USING_GETENTROPY #elif defined(__Fuchsia__) # define _LIBCPP_USING_FUCHSIA_CPRNG @@ -1088,6 +1088,7 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( defined(__sun__) || \ defined(__MVS__) || \ defined(_AIX) || \ + defined(__EMSCRIPTEN__) || \ defined(__CYGWIN__) # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(__Fuchsia__) @@ -1311,35 +1312,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( #define _LIBCPP_DISABLE_AVAILABILITY // End of Yandex-specific -#if defined(_LIBCPP_COMPILER_IBM) || defined(__CUDACC__) -#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO -#endif - -#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS -#else - // Don't warn about macro conflicts when we can restore them at the - // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) -# else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") -# endif -#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) +# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") #ifndef _LIBCPP_NO_AUTO_LINK # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) @@ -1413,28 +1387,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // Note that this can be replaced by #error as soon as clang-cl // implements msvc::no_unique_address, since there should be no C++20 // compiler that doesn't support one of the two attributes at that point. - // We geenrally don't want to use this macro outside of C++20-only code, - // because using it conditionally in one language version only would make - // the ABI inconsistent. -#endif - -#if __has_cpp_attribute(msvc::no_unique_address) - // MSVC implements [[no_unique_address]] as a silent no-op currently. - // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) - // However, MSVC implements [[msvc::no_unique_address]] which does what - // [[no_unique_address]] is supposed to do, in general. - - // Clang-cl does not yet (14.0) implement either [[no_unique_address]] or - // [[msvc::no_unique_address]] though. If/when it does implement - // [[msvc::no_unique_address]], this should be preferred though. -# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] -#elif __has_cpp_attribute(no_unique_address) -# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] -#else -# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ - // Note that this can be replaced by #error as soon as clang-cl - // implements msvc::no_unique_address, since there should be no C++20 - // compiler that doesn't support one of the two attributes at that point. // We generally don't want to use this macro outside of C++20-only code, // because using it conditionally in one language version only would make // the ABI inconsistent. diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h index 6034fe5075..5ff2f01ac7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/directory_iterator.h @@ -44,25 +44,31 @@ public: public: //ctor & dtor + _LIBCPP_HIDE_FROM_ABI directory_iterator() noexcept {} + _LIBCPP_HIDE_FROM_ABI explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {} + _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts) : directory_iterator(__p, nullptr, __opts) {} + _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {} + _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts, error_code& __ec) : directory_iterator(__p, &__ec, __opts) {} - directory_iterator(const directory_iterator&) = default; - directory_iterator(directory_iterator&&) = default; - directory_iterator& operator=(const directory_iterator&) = default; + _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default; + _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default; + _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(const directory_iterator&) = default; + _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(directory_iterator&& __o) noexcept { // non-default implementation provided to support self-move assign. if (this != &__o) { @@ -71,27 +77,32 @@ public: return *this; } - ~directory_iterator() = default; + _LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default; + _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { _LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced"); return __dereference(); } + _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &**this; } + _LIBCPP_HIDE_FROM_ABI directory_iterator& operator++() { return __increment(); } + _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) { __dir_element_proxy __p(**this); __increment(); return __p; } + _LIBCPP_HIDE_FROM_ABI directory_iterator& increment(error_code& __ec) { return __increment(&__ec); } private: - inline _LIBCPP_INLINE_VISIBILITY friend bool + inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept; @@ -110,25 +121,25 @@ private: shared_ptr<__dir_stream> __imp_; }; -inline _LIBCPP_INLINE_VISIBILITY bool +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { return __lhs.__imp_ == __rhs.__imp_; } -inline _LIBCPP_INLINE_VISIBILITY bool +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { return !(__lhs == __rhs); } // enable directory_iterator range-based for statements -inline _LIBCPP_INLINE_VISIBILITY directory_iterator +inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; } -inline _LIBCPP_INLINE_VISIBILITY directory_iterator +inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h index 29bb1e94a8..8fafd72c7e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/path.h @@ -71,6 +71,7 @@ struct __can_convert_char<char32_t> { }; template <class _ECharT> +_LIBCPP_HIDE_FROM_ABI typename enable_if<__can_convert_char<_ECharT>::value, bool>::type __is_separator(_ECharT __e) { #if defined(_LIBCPP_WIN32API) @@ -101,10 +102,16 @@ struct __is_pathable_string< : public __can_convert_char<_ECharT> { using _Str = basic_string<_ECharT, _Traits, _Alloc>; using _Base = __can_convert_char<_ECharT>; + + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } + + _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; } @@ -117,10 +124,16 @@ struct __is_pathable_string< : public __can_convert_char<_ECharT> { using _Str = basic_string_view<_ECharT, _Traits>; using _Base = __can_convert_char<_ECharT>; + + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } + + _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; } @@ -138,7 +151,10 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> : __can_convert_char<typename remove_const<_ECharT>::type> { using _Base = __can_convert_char<typename remove_const<_ECharT>::type>; + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } + + _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(const _ECharT* __b) { using _Iter = const _ECharT*; const _ECharT __sentinel = _ECharT{}; @@ -148,6 +164,7 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> return __e; } + _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } }; @@ -164,9 +181,13 @@ struct __is_pathable_iter< using _ECharT = typename iterator_traits<_Iter>::value_type; using _Base = __can_convert_char<_ECharT>; + _LIBCPP_HIDE_FROM_ABI static _Iter __range_begin(_Iter __b) { return __b; } + + _LIBCPP_HIDE_FROM_ABI static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; } + _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Iter __b) { return *__b; } }; @@ -216,6 +237,7 @@ struct _PathCVT { typedef __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Widener; #endif + _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _ECharT const* __b, _ECharT const* __e) { #if defined(_LIBCPP_WIN32API) @@ -228,6 +250,7 @@ struct _PathCVT { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) { static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); if (__b == __e) @@ -245,6 +268,7 @@ struct _PathCVT { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) { static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); const _ECharT __sentinel = _ECharT{}; @@ -265,6 +289,7 @@ struct _PathCVT { } template <class _Source> + _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) { using _Traits = __is_pathable<_Source>; __append_range(__dest, _Traits::__range_begin(__s), @@ -277,6 +302,7 @@ template <> struct _PathCVT<__path_value> { template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type __append_range(__path_string& __dest, _Iter __b, _Iter __e) { for (; __b != __e; ++__b) @@ -284,12 +310,14 @@ struct _PathCVT<__path_value> { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type __append_range(__path_string& __dest, _Iter __b, _Iter __e) { __dest.append(__b, __e); } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) { const char __sentinel = char{}; for (; *__b != __sentinel; ++__b) @@ -297,6 +325,7 @@ struct _PathCVT<__path_value> { } template <class _Source> + _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) { using _Traits = __is_pathable<_Source>; __append_range(__dest, _Traits::__range_begin(__s), @@ -308,6 +337,7 @@ struct _PathCVT<__path_value> { template <> struct _PathCVT<char> { + _LIBCPP_HIDE_FROM_ABI static void __append_string(__path_string& __dest, const basic_string<char> &__str) { size_t __size = __char_to_wide(__str, nullptr, 0); @@ -317,6 +347,7 @@ struct _PathCVT<char> { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type __append_range(__path_string& __dest, _Iter __b, _Iter __e) { basic_string<char> __tmp(__b, __e); @@ -324,6 +355,7 @@ struct _PathCVT<char> { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type __append_range(__path_string& __dest, _Iter __b, _Iter __e) { basic_string<char> __tmp(__b, __e); @@ -331,6 +363,7 @@ struct _PathCVT<char> { } template <class _Iter> + _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) { const char __sentinel = char{}; basic_string<char> __tmp; @@ -340,6 +373,7 @@ struct _PathCVT<char> { } template <class _Source> + _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) { using _Traits = __is_pathable<_Source>; __append_range(__dest, _Traits::__range_begin(__s), @@ -353,6 +387,7 @@ struct _PathExport { typedef __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Widener; template <class _Str> + _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) { string __utf8; _Narrower()(back_inserter(__utf8), __src.data(), __src.data() + __src.size()); @@ -363,6 +398,7 @@ struct _PathExport { template <> struct _PathExport<char> { template <class _Str> + _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) { size_t __size = __wide_to_char(__src, nullptr, 0); size_t __pos = __dest.size(); @@ -374,6 +410,7 @@ struct _PathExport<char> { template <> struct _PathExport<wchar_t> { template <class _Str> + _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) { __dest.append(__src.begin(), __src.end()); } @@ -382,6 +419,7 @@ struct _PathExport<wchar_t> { template <> struct _PathExport<char16_t> { template <class _Str> + _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) { __dest.append(__src.begin(), __src.end()); } @@ -393,6 +431,7 @@ struct _PathExport<char8_t> { typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower; template <class _Str> + _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) { _Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size()); } @@ -429,21 +468,23 @@ public: }; // constructors and destructor - _LIBCPP_INLINE_VISIBILITY path() noexcept {} - _LIBCPP_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {} - _LIBCPP_INLINE_VISIBILITY path(path&& __p) noexcept + _LIBCPP_HIDE_FROM_ABI path() noexcept {} + _LIBCPP_HIDE_FROM_ABI path(const path& __p) : __pn_(__p.__pn_) {} + _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept : __pn_(_VSTD::move(__p.__pn_)) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path(string_type&& __s, format = format::auto_format) noexcept : __pn_(_VSTD::move(__s)) {} template <class _Source, class = _EnableIfPathable<_Source, void> > + _LIBCPP_HIDE_FROM_ABI path(const _Source& __src, format = format::auto_format) { _SourceCVT<_Source>::__append_source(__pn_, __src); } template <class _InputIt> + _LIBCPP_HIDE_FROM_ABI path(_InputIt __first, _InputIt __last, format = format::auto_format) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); @@ -460,41 +501,42 @@ public: #endif */ - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI ~path() = default; // assignments - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator=(const path& __p) { __pn_ = __p.__pn_; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator=(path&& __p) noexcept { __pn_ = _VSTD::move(__p.__pn_); return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator=(string_type&& __s) noexcept { __pn_ = _VSTD::move(__s); return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept { __pn_ = _VSTD::move(__s); return *this; } template <class _Source> - _LIBCPP_INLINE_VISIBILITY _EnableIfPathable<_Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator=(const _Source& __src) { return this->assign(__src); } template <class _Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) { __pn_.clear(); _SourceCVT<_Source>::__append_source(__pn_, __src); @@ -502,6 +544,7 @@ public: } template <class _InputIt> + _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; __pn_.clear(); @@ -512,6 +555,7 @@ public: public: // appends #if defined(_LIBCPP_WIN32API) + _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) { auto __p_root_name = __p.__root_name(); auto __p_root_name_size = __p_root_name.size(); @@ -538,15 +582,18 @@ public: } template <class _Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) { return operator/=(path(__src)); } template <class _InputIt> + _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) { return operator/=(path(__first, __last)); } #else + _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) { if (__p.is_absolute()) { __pn_ = __p.__pn_; @@ -562,12 +609,13 @@ public: // is known at compile time to be "/' since the user almost certainly intended // to append a separator instead of overwriting the path with "/" template <class _Source> - _LIBCPP_INLINE_VISIBILITY _EnableIfPathable<_Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) { return this->append(__src); } template <class _Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) { using _Traits = __is_pathable<_Source>; using _CVT = _PathCVT<_SourceChar<_Source> >; @@ -581,6 +629,7 @@ public: } template <class _InputIt> + _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); @@ -595,37 +644,38 @@ public: #endif // concatenation - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator+=(const path& __x) { __pn_ += __x.__pn_; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator+=(const string_type& __x) { __pn_ += __x; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator+=(__string_view __x) { __pn_ += __x; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator+=(const value_type* __x) { __pn_ += __x; return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& operator+=(value_type __x) { __pn_ += __x; return *this; } template <class _ECharT> + _LIBCPP_HIDE_FROM_ABI typename enable_if<__can_convert_char<_ECharT>::value, path&>::type operator+=(_ECharT __x) { _PathCVT<_ECharT>::__append_source(__pn_, @@ -634,17 +684,20 @@ public: } template <class _Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator+=(const _Source& __x) { return this->concat(__x); } template <class _Source> + _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) { _SourceCVT<_Source>::__append_source(__pn_, __x); return *this; } template <class _InputIt> + _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); @@ -652,9 +705,10 @@ public: } // modifiers - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); } + _LIBCPP_HIDE_FROM_ABI path& make_preferred() { #if defined(_LIBCPP_WIN32API) _VSTD::replace(__pn_.begin(), __pn_.end(), L'/', L'\\'); @@ -662,7 +716,7 @@ public: return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI path& remove_filename() { auto __fname = __filename(); if (!__fname.empty()) @@ -670,6 +724,7 @@ public: return *this; } + _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) { remove_filename(); return (*this /= __replacement); @@ -677,25 +732,26 @@ public: path& replace_extension(const path& __replacement = path()); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); } // private helper to allow reserving memory in the path - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); } // native format observers - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); } - _LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; } #if defined(_LIBCPP_WIN32API) - _LIBCPP_INLINE_VISIBILITY _VSTD::wstring wstring() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::wstring wstring() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::wstring generic_wstring() const { _VSTD::wstring __s; __s.resize(__pn_.size()); @@ -706,6 +762,7 @@ public: #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > + _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const { using _Str = basic_string<_ECharT, _Traits, _Allocator>; @@ -715,10 +772,10 @@ public: return __s; } - _LIBCPP_INLINE_VISIBILITY _VSTD::string string() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::string string() const { return string<char>(); } - _LIBCPP_INLINE_VISIBILITY __u8_string u8string() const { + _LIBCPP_HIDE_FROM_ABI __u8_string u8string() const { using _CVT = __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__>; __u8_string __s; __s.reserve(__pn_.size()); @@ -726,16 +783,17 @@ public: return __s; } - _LIBCPP_INLINE_VISIBILITY _VSTD::u16string u16string() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::u16string u16string() const { return string<char16_t>(); } - _LIBCPP_INLINE_VISIBILITY _VSTD::u32string u32string() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::u32string u32string() const { return string<char32_t>(); } // generic format observers template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > + _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> generic_string(const _Allocator& __a = _Allocator()) const { using _Str = basic_string<_ECharT, _Traits, _Allocator>; @@ -748,9 +806,10 @@ public: return __s; } - _VSTD::string generic_string() const { return generic_string<char>(); } - _VSTD::u16string generic_u16string() const { return generic_string<char16_t>(); } - _VSTD::u32string generic_u32string() const { return generic_string<char32_t>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::string generic_string() const { return generic_string<char>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u16string generic_u16string() const { return generic_string<char16_t>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u32string generic_u32string() const { return generic_string<char32_t>(); } + _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const { __u8_string __s = u8string(); _VSTD::replace(__s.begin(), __s.end(), '\\', '/'); @@ -759,16 +818,17 @@ public: #endif /* !_LIBCPP_HAS_NO_LOCALIZATION */ #else /* _LIBCPP_WIN32API */ - _LIBCPP_INLINE_VISIBILITY _VSTD::string string() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::string string() const { return __pn_; } #ifndef _LIBCPP_HAS_NO_CHAR8_T - _LIBCPP_INLINE_VISIBILITY _VSTD::u8string u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u8string u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } #else - _LIBCPP_INLINE_VISIBILITY _VSTD::string u8string() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::string u8string() const { return __pn_; } #endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > + _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const { using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>; @@ -780,39 +840,40 @@ public: } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_INLINE_VISIBILITY _VSTD::wstring wstring() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::wstring wstring() const { return string<wchar_t>(); } #endif - _LIBCPP_INLINE_VISIBILITY _VSTD::u16string u16string() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::u16string u16string() const { return string<char16_t>(); } - _LIBCPP_INLINE_VISIBILITY _VSTD::u32string u32string() const { + _LIBCPP_HIDE_FROM_ABI _VSTD::u32string u32string() const { return string<char32_t>(); } #endif /* !_LIBCPP_HAS_NO_LOCALIZATION */ // generic format observers - _VSTD::string generic_string() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::string generic_string() const { return __pn_; } #ifndef _LIBCPP_HAS_NO_CHAR8_T - _VSTD::u8string generic_u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u8string generic_u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } #else - _VSTD::string generic_u8string() const { return __pn_; } + _LIBCPP_HIDE_FROM_ABI _VSTD::string generic_u8string() const { return __pn_; } #endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > + _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> generic_string(const _Allocator& __a = _Allocator()) const { return string<_ECharT, _Traits, _Allocator>(__a); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _VSTD::wstring generic_wstring() const { return string<wchar_t>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::wstring generic_wstring() const { return string<wchar_t>(); } #endif - _VSTD::u16string generic_u16string() const { return string<char16_t>(); } - _VSTD::u32string generic_u32string() const { return string<char32_t>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u16string generic_u16string() const { return string<char16_t>(); } + _LIBCPP_HIDE_FROM_ABI _VSTD::u32string generic_u32string() const { return string<char32_t>(); } #endif /* !_LIBCPP_HAS_NO_LOCALIZATION */ #endif /* !_LIBCPP_WIN32API */ @@ -829,77 +890,77 @@ private: public: // compare - _LIBCPP_INLINE_VISIBILITY int compare(const path& __p) const noexcept { + _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); } - _LIBCPP_INLINE_VISIBILITY int compare(const string_type& __s) const { + _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); } - _LIBCPP_INLINE_VISIBILITY int compare(__string_view __s) const { + _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); } - _LIBCPP_INLINE_VISIBILITY int compare(const value_type* __s) const { + _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); } // decomposition - _LIBCPP_INLINE_VISIBILITY path root_name() const { + _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); } - _LIBCPP_INLINE_VISIBILITY path root_directory() const { + _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); } - _LIBCPP_INLINE_VISIBILITY path root_path() const { + _LIBCPP_HIDE_FROM_ABI path root_path() const { #if defined(_LIBCPP_WIN32API) return string_type(__root_path_raw()); #else return root_name().append(string_type(__root_directory())); #endif } - _LIBCPP_INLINE_VISIBILITY path relative_path() const { + _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); } - _LIBCPP_INLINE_VISIBILITY path parent_path() const { + _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); } - _LIBCPP_INLINE_VISIBILITY path filename() const { + _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); } - _LIBCPP_INLINE_VISIBILITY path stem() const { return string_type(__stem()); } - _LIBCPP_INLINE_VISIBILITY path extension() const { + _LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); } + _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); } // query - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_root_name() const { + _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_root_directory() const { + _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_root_path() const { + _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_relative_path() const { + _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_parent_path() const { + _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_filename() const { + _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_stem() const { return !__stem().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_extension() const { + _LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); } + _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); } - _LIBCPP_INLINE_VISIBILITY bool is_absolute() const { + _LIBCPP_HIDE_FROM_ABI bool is_absolute() const { #if defined(_LIBCPP_WIN32API) __string_view __root_name_str = __root_name(); __string_view __root_dir = __root_directory(); @@ -923,13 +984,13 @@ public: return has_root_directory(); #endif } - _LIBCPP_INLINE_VISIBILITY bool is_relative() const { return !is_absolute(); } + _LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); } // relative paths path lexically_normal() const; path lexically_relative(const path& __base) const; - _LIBCPP_INLINE_VISIBILITY path lexically_proximate(const path& __base) const { + _LIBCPP_HIDE_FROM_ABI path lexically_proximate(const path& __base) const { path __result = this->lexically_relative(__base); if (__result.native().empty()) return *this; @@ -945,7 +1006,7 @@ public: #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) template <class _CharT, class _Traits> - _LIBCPP_INLINE_VISIBILITY friend + _LIBCPP_HIDE_FROM_ABI friend typename enable_if<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, basic_ostream<_CharT, _Traits>&>::type @@ -955,7 +1016,7 @@ public: } template <class _CharT, class _Traits> - _LIBCPP_INLINE_VISIBILITY friend + _LIBCPP_HIDE_FROM_ABI friend typename enable_if<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, basic_ostream<_CharT, _Traits>&>::type @@ -965,7 +1026,7 @@ public: } template <class _CharT, class _Traits> - _LIBCPP_INLINE_VISIBILITY friend basic_istream<_CharT, _Traits>& + _LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { basic_string<_CharT, _Traits> __tmp; __is >> _VSTD::__quoted(__tmp); @@ -974,33 +1035,32 @@ public: } #endif // !_LIBCPP_HAS_NO_LOCALIZATION - friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) == 0; } - friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) != 0; } - friend _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator<(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) < 0; } - friend _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator<=(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) <= 0; } - friend _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator>(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) > 0; } - friend _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs, const path& __rhs) noexcept { + friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept { return __lhs.__compare(__rhs.__pn_) >= 0; } - friend _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs, - const path& __rhs) { + friend _LIBCPP_HIDE_FROM_ABI path operator/(const path& __lhs, const path& __rhs) { path __result(__lhs); __result /= __rhs; return __result; } private: - inline _LIBCPP_INLINE_VISIBILITY path& + inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) noexcept { __pn_ = string_type(__s); return *this; @@ -1008,7 +1068,7 @@ private: string_type __pn_; }; -inline _LIBCPP_INLINE_VISIBILITY void swap(path& __lhs, path& __rhs) noexcept { +inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__filesystem/u8path.h b/contrib/libs/cxxsupp/libcxx/include/__filesystem/u8path.h index ee25521f28..d35faa14bb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__filesystem/u8path.h +++ b/contrib/libs/cxxsupp/libcxx/include/__filesystem/u8path.h @@ -10,11 +10,19 @@ #ifndef _LIBCPP___FILESYSTEM_U8PATH_H #define _LIBCPP___FILESYSTEM_U8PATH_H +#include <__algorithm/unwrap_iter.h> #include <__availability> #include <__config> #include <__filesystem/path.h> +#include <string> #include <type_traits> +// Only required on Windows for __widen_from_utf8, and included conservatively +// because it requires support for localization. +#if defined(_LIBCPP_WIN32API) +# include <locale> +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h index e5c3b9fda2..55cde0044e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/buffer.h @@ -11,12 +11,16 @@ #define _LIBCPP___FORMAT_BUFFER_H #include <__algorithm/copy_n.h> +#include <__algorithm/max.h> +#include <__algorithm/min.h> #include <__algorithm/unwrap_iter.h> #include <__config> #include <__format/enable_insertable.h> +#include <__format/format_to_n_result.h> #include <__format/formatter.h> // for __char_type TODO FMT Move the concept? #include <__iterator/back_insert_iterator.h> #include <__iterator/concepts.h> +#include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> #include <__iterator/wrap_iter.h> #include <__utility/move.h> @@ -28,6 +32,9 @@ # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 @@ -94,11 +101,11 @@ template <__formatter::__char_type _CharT> class _LIBCPP_TEMPLATE_VIS __internal_storage { public: _LIBCPP_HIDE_FROM_ABI _CharT* begin() { return __buffer_; } - _LIBCPP_HIDE_FROM_ABI size_t capacity() { return __buffer_size_; } + + static constexpr size_t __buffer_size = 256 / sizeof(_CharT); private: - static constexpr size_t __buffer_size_ = 256 / sizeof(_CharT); - _CharT __buffer_[__buffer_size_]; + _CharT __buffer_[__buffer_size]; }; /// A storage writing directly to the storage. @@ -216,10 +223,9 @@ requires(output_iterator<_OutIt, const _CharT&>) class _LIBCPP_TEMPLATE_VIS __direct_storage<_CharT>, __internal_storage<_CharT>>; public: - _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires( - same_as<_Storage, __internal_storage<_CharT>>) - : __output_(__storage_.begin(), __storage_.capacity(), this), - __writer_(_VSTD::move(__out_it)) {} + _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) + requires(same_as<_Storage, __internal_storage<_CharT>>) + : __output_(__storage_.begin(), __storage_.__buffer_size, this), __writer_(_VSTD::move(__out_it)) {} _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it) requires( same_as<_Storage, __direct_storage<_CharT>>) @@ -263,14 +269,101 @@ public: private: __internal_storage<_CharT> __storage_; - __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.capacity(), this}; + __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this}; size_t __size_{0}; }; +/// The base of a buffer that counts and limits the number of insertions. +template <class _OutIt, __formatter::__char_type _CharT, bool> + requires(output_iterator<_OutIt, const _CharT&>) +struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base { + using _Size = iter_difference_t<_OutIt>; + +public: + _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __n) + : __writer_(_VSTD::move(__out_it)), __n_(_VSTD::max(_Size(0), __n)) {} + + _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { + if (_Size(__size_) <= __n_) + __writer_.flush(__ptr, _VSTD::min(_Size(__size), __n_ - __size_)); + __size_ += __size; + } + +protected: + __internal_storage<_CharT> __storage_; + __output_buffer<_CharT> __output_{__storage_.begin(), __storage_.__buffer_size, this}; + typename __writer_selector<_OutIt, _CharT>::type __writer_; + + _Size __n_; + _Size __size_{0}; +}; + +/// The base of a buffer that counts and limits the number of insertions. +/// +/// This version is used when \c __enable_direct_output<_OutIt, _CharT> == true. +/// +/// This class limits the size available the the direct writer so it will not +/// exceed the maximum number of code units. +template <class _OutIt, __formatter::__char_type _CharT> + requires(output_iterator<_OutIt, const _CharT&>) +class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> { + using _Size = iter_difference_t<_OutIt>; + +public: + _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __n) + : __output_(_VSTD::__unwrap_iter(__out_it), __n, this), __writer_(_VSTD::move(__out_it)) { + if (__n <= 0) [[unlikely]] + __output_.reset(__storage_.begin(), __storage_.__buffer_size); + } + + _LIBCPP_HIDE_FROM_ABI void flush(_CharT* __ptr, size_t __size) { + // A flush to the direct writer happens in two occasions: + // - The format function has written the maximum number of allowed code + // units. At this point it's no longer valid to write to this writer. So + // switch to the internal storage. This internal storage doesn't need to + // be written anywhere so the flush for that storage writes no output. + // - The format_to_n function is finished. In this case there's no need to + // switch the buffer, but for simplicity the buffers are still switched. + // When the __n <= 0 the constructor already switched the buffers. + if (__size_ == 0 && __ptr != __storage_.begin()) { + __writer_.flush(__ptr, __size); + __output_.reset(__storage_.begin(), __storage_.__buffer_size); + } + + __size_ += __size; + } + +protected: + __internal_storage<_CharT> __storage_; + __output_buffer<_CharT> __output_; + __writer_direct<_OutIt, _CharT> __writer_; + + _Size __size_{0}; +}; + +/// The buffer that counts and limits the number of insertions. +template <class _OutIt, __formatter::__char_type _CharT> + requires(output_iterator<_OutIt, const _CharT&>) +struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer final + : public __format_to_n_buffer_base< _OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>> { + using _Base = __format_to_n_buffer_base<_OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>>; + using _Size = iter_difference_t<_OutIt>; + +public: + _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer(_OutIt __out_it, _Size __n) : _Base(_VSTD::move(__out_it), __n) {} + _LIBCPP_HIDE_FROM_ABI auto make_output_iterator() { return this->__output_.make_output_iterator(); } + + _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> result() && { + this->__output_.flush(); + return {_VSTD::move(this->__writer_).out(), this->__size_}; + } +}; } // namespace __format #endif //_LIBCPP_STD_VER > 17 _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FORMAT_BUFFER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h index 3c61446378..3f2afc898d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h @@ -16,7 +16,9 @@ #include <__format/format_error.h> #include <__format/format_fwd.h> #include <__format/format_parse_context.h> +#include <__functional/invoke.h> #include <__memory/addressof.h> +#include <__utility/forward.h> #include <__utility/unreachable.h> #include <__variant/monostate.h> #include <string> diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h index f720fa5117..6be9f216db 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_iterator.h @@ -79,27 +79,25 @@ public: typedef typename iterator_traits<iterator_type>::difference_type difference_type; typedef iterator_type pointer; -#ifndef _LIBCPP_CXX03_LANG typedef typename iterator_traits<iterator_type>::reference __reference; typedef typename conditional< is_reference<__reference>::value, typename remove_reference<__reference>::type&&, __reference >::type reference; -#else - typedef typename iterator_traits<iterator_type>::reference reference; -#endif - #endif // _LIBCPP_STD_VER > 17 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 + explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator++() { ++__current_; return *this; } + _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 pointer operator->() const { return __current_; } #if _LIBCPP_STD_VER > 17 _LIBCPP_HIDE_FROM_ABI constexpr - explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} - - _LIBCPP_HIDE_FROM_ABI constexpr move_iterator() requires is_constructible_v<_Iter> : __current_() {} template <class _Up> @@ -126,9 +124,6 @@ public: reference operator[](difference_type __n) const { return ranges::iter_move(__current_ + __n); } _LIBCPP_HIDE_FROM_ABI constexpr - move_iterator& operator++() { ++__current_; return *this; } - - _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(int) requires forward_iterator<_Iter> { @@ -139,9 +134,6 @@ public: void operator++(int) { ++__current_; } #else _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 - explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator() : __current_() {} template <class _Up, class = __enable_if_t< @@ -170,8 +162,6 @@ public: reference operator[](difference_type __n) const { return static_cast<reference>(__current_[__n]); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 - move_iterator& operator++() { ++__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; } #endif // _LIBCPP_STD_VER > 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_sentinel.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_sentinel.h index abacc91be8..5adf877b34 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/move_sentinel.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/move_sentinel.h @@ -31,7 +31,7 @@ public: move_sentinel() = default; _LIBCPP_HIDE_FROM_ABI constexpr - explicit move_sentinel(_Sent __s) : __last_(_VSTD::move(__s)) {} + explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {} template <class _S2> requires convertible_to<const _S2&, _Sent> diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale index aba24ee064..1e4cb55375 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale +++ b/contrib/libs/cxxsupp/libcxx/include/__locale @@ -34,8 +34,7 @@ # include <__support/newlib/xlocale.h> #elif defined(__OpenBSD__) # include <__support/openbsd/xlocale.h> -#elif (defined(__APPLE__) || defined(__FreeBSD__) \ - || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) +#elif (defined(__APPLE__) || defined(__FreeBSD__) || defined(__IBMCPP__)) # include <xlocale.h> #elif defined(__Fuchsia__) # include <__support/fuchsia/xlocale.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h index 8640cd1b4e..330537fa00 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h @@ -109,39 +109,63 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last) __first[__q] += __r; __first[0] = __r; } + // Initialize indexing terms used with if statements as an optimization to + // avoid calculating modulo n on every loop iteration for each term. + size_t __kmodn = 0; // __k % __n + size_t __k1modn = __n - 1; // (__k - 1) % __n + size_t __kpmodn = __p % __n; // (__k + __p) % __n + size_t __kqmodn = __q % __n; // (__k + __q) % __n + for (size_t __k = 1; __k <= __s; ++__k) { - const size_t __kmodn = __k % __n; - const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] - ^ __first[(__k - 1) % __n]); - __first[__kpmodn] += __r; - __r += __kmodn + __v_[__k-1]; - __first[(__k + __q) % __n] += __r; - __first[__kmodn] = __r; + if (++__kmodn == __n) + __kmodn = 0; + if (++__k1modn == __n) + __k1modn = 0; + if (++__kpmodn == __n) + __kpmodn = 0; + if (++__kqmodn == __n) + __kqmodn = 0; + + result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]); + __first[__kpmodn] += __r; + __r += __kmodn + __v_[__k - 1]; + __first[__kqmodn] += __r; + __first[__kmodn] = __r; } for (size_t __k = __s + 1; __k < __m; ++__k) { - const size_t __kmodn = __k % __n; - const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] - ^ __first[(__k - 1) % __n]); - __first[__kpmodn] += __r; - __r += __kmodn; - __first[(__k + __q) % __n] += __r; - __first[__kmodn] = __r; + if (++__kmodn == __n) + __kmodn = 0; + if (++__k1modn == __n) + __k1modn = 0; + if (++__kpmodn == __n) + __kpmodn = 0; + if (++__kqmodn == __n) + __kqmodn = 0; + + result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn] ^ __first[__k1modn]); + __first[__kpmodn] += __r; + __r += __kmodn; + __first[__kqmodn] += __r; + __first[__kmodn] = __r; } for (size_t __k = __m; __k < __m + __n; ++__k) { - const size_t __kmodn = __k % __n; - const size_t __kpmodn = (__k + __p) % __n; - result_type __r = 1566083941 * _Tp(__first[__kmodn] + - __first[__kpmodn] + - __first[(__k - 1) % __n]); - __first[__kpmodn] ^= __r; - __r -= __kmodn; - __first[(__k + __q) % __n] ^= __r; - __first[__kmodn] = __r; + if (++__kmodn == __n) + __kmodn = 0; + if (++__k1modn == __n) + __k1modn = 0; + if (++__kpmodn == __n) + __kpmodn = 0; + if (++__kqmodn == __n) + __kqmodn = 0; + + result_type __r = 1566083941 * _Tp(__first[__kmodn] + __first[__kpmodn] + __first[__k1modn]); + __first[__kpmodn] ^= __r; + __r -= __kmodn; + __first[__kqmodn] ^= __r; + __first[__kmodn] = __r; } } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h index 241f90c0a1..87df1d18ba 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h @@ -68,8 +68,6 @@ namespace ranges { template <range _Rp> using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>; -#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - // [range.sized] template <class _Tp> concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); }; @@ -135,8 +133,6 @@ namespace ranges { (is_lvalue_reference_v<_Tp> || (movable<remove_reference_t<_Tp>> && !__is_std_initializer_list<remove_cvref_t<_Tp>>)))); -#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) - } // namespace ranges #endif // _LIBCPP_STD_VER > 17 diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h index 2f24d89b9c..35d1af1e64 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 // [range.prim.data] @@ -99,7 +99,7 @@ inline namespace __cpo { } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h index 514c554ef4..b832668313 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 namespace ranges { template<class> @@ -128,7 +128,7 @@ inline namespace __cpo { } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_const.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_const.h new file mode 100644 index 0000000000..c616a13f84 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_const.h @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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_ADD_CONST_H +#define _LIBCPP___TYPE_TRAITS_ADD_CONST_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const { + typedef _LIBCPP_NODEBUG const _Tp type; +}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_const_t = typename add_const<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_CONST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_cv.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_cv.h new file mode 100644 index 0000000000..8a85353f16 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_cv.h @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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_ADD_CV_H +#define _LIBCPP___TYPE_TRAITS_ADD_CV_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv { + typedef _LIBCPP_NODEBUG const volatile _Tp type; +}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_CV_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_lvalue_reference.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_lvalue_reference.h new file mode 100644 index 0000000000..0d1ee4185c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_lvalue_reference.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_ADD_LVALUE_REFERENCE_H +#define _LIBCPP___TYPE_TRAITS_ADD_LVALUE_REFERENCE_H + +#include <__config> +#include <__type_traits/is_referenceable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; +template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp& type; }; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference +{typedef _LIBCPP_NODEBUG typename __add_lvalue_reference_impl<_Tp>::type type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_LVALUE_REFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.h new file mode 100644 index 0000000000..aea2490c5d --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_pointer.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_ADD_POINTER_H +#define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H + +#include <__config> +#include <__type_traits/is_referenceable.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_reference.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, + bool = __is_referenceable<_Tp>::value || + _IsSame<typename remove_cv<_Tp>::type, void>::value> +struct __add_pointer_impl + {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;}; +template <class _Tp> struct __add_pointer_impl<_Tp, false> + {typedef _LIBCPP_NODEBUG _Tp type;}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer + {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_rvalue_reference.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_rvalue_reference.h new file mode 100644 index 0000000000..b2a1428095 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_rvalue_reference.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_ADD_RVALUE_REFERENCE_H +#define _LIBCPP___TYPE_TRAITS_ADD_RVALUE_REFERENCE_H + +#include <__config> +#include <__type_traits/is_referenceable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; +template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp&& type; }; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference +{typedef _LIBCPP_NODEBUG typename __add_rvalue_reference_impl<_Tp>::type type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_RVALUE_REFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_volatile.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_volatile.h new file mode 100644 index 0000000000..73b1cb8418 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/add_volatile.h @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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_ADD_VOLATILE_H +#define _LIBCPP___TYPE_TRAITS_ADD_VOLATILE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile { + typedef _LIBCPP_NODEBUG volatile _Tp type; +}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ADD_VOLATILE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h new file mode 100644 index 0000000000..ef182a9ed6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/conditional.h @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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_CONDITIONAL_H +#define _LIBCPP___TYPE_TRAITS_CONDITIONAL_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +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; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_CONDITIONAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/decay.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/decay.h new file mode 100644 index 0000000000..d47ad03fe0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/decay.h @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// 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_DECAY_H +#define _LIBCPP___TYPE_TRAITS_DECAY_H + +#include <__config> +#include <__type_traits/add_pointer.h> +#include <__type_traits/conditional.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_referenceable.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_extent.h> +#include <__type_traits/remove_reference.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Up, bool> +struct __decay { + typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type; +}; + +template <class _Up> +struct __decay<_Up, true> { +public: + typedef _LIBCPP_NODEBUG typename conditional + < + is_array<_Up>::value, + typename remove_extent<_Up>::type*, + typename conditional + < + is_function<_Up>::value, + typename add_pointer<_Up>::type, + typename remove_cv<_Up>::type + >::type + >::type type; +}; + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS decay +{ +private: + typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; +public: + typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type; +}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using decay_t = typename decay<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_DECAY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/enable_if.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/enable_if.h new file mode 100644 index 0000000000..c5e8df45ea --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/enable_if.h @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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_ENABLE_IF_H +#define _LIBCPP___TYPE_TRAITS_ENABLE_IF_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;}; + +template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; + +#if _LIBCPP_STD_VER > 11 +template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ENABLE_IF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h new file mode 100644 index 0000000000..0da65cf360 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/extent.h @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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_EXTENT_H +#define _LIBCPP___TYPE_TRAITS_EXTENT_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 + +#if __has_keyword(__array_extent) && !defined(__CUDACC__) + +template<class _Tp, size_t _Dim = 0> +struct _LIBCPP_TEMPLATE_VIS extent + : integral_constant<size_t, __array_extent(_Tp, _Dim)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, unsigned _Ip = 0> +inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); +#endif + +#else // __has_keyword(__array_extent) + +template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TEMPLATE_VIS extent + : public integral_constant<size_t, 0> {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], 0> + : public integral_constant<size_t, 0> {}; +template <class _Tp, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], _Ip> + : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0> + : public integral_constant<size_t, _Np> {}; +template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> + : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, unsigned _Ip = 0> +inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; +#endif + +#endif // __has_keyword(__array_extent) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_EXTENT_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 new file mode 100644 index 0000000000..0480118b37 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_abstract.h @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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_ABSTRACT_H +#define _LIBCPP___TYPE_TRAITS_IS_ABSTRACT_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_abstract + : public integral_constant<bool, __is_abstract(_Tp)> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_ABSTRACT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.h new file mode 100644 index 0000000000..f32aec8ac5 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_aggregate.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_AGGREGATE_H +#define _LIBCPP___TYPE_TRAITS_IS_AGGREGATE_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 _LIBCPP_STD_VER > 14 + +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; + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_AGGREGATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_arithmetic.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_arithmetic.h new file mode 100644 index 0000000000..6d631f41c7 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_arithmetic.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_ARITHMETIC_H +#define _LIBCPP___TYPE_TRAITS_IS_ARITHMETIC_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_integral.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_arithmetic + : public integral_constant<bool, is_integral<_Tp>::value || + is_floating_point<_Tp>::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_ARITHMETIC_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.h new file mode 100644 index 0000000000..766d2a2030 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_array.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_ARRAY_H +#define _LIBCPP___TYPE_TRAITS_IS_ARRAY_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 + +// TODO: Clang incorrectly reports that __is_array is true for T[0]. +// Re-enable the branch once https://llvm.org/PR54705 is fixed. +#if __has_keyword(__is_array) && 0 + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_array_v = __is_array(_Tp); +#endif + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array + : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> + : public true_type {}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> + : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_array_v = is_array<_Tp>::value; +#endif + +#endif // __has_keyword(__is_array) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_ARRAY_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 new file mode 100644 index 0000000000..b944a65d28 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_base_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_IS_BASE_OF_H +#define _LIBCPP___TYPE_TRAITS_IS_BASE_OF_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 _Bp, class _Dp> +struct _LIBCPP_TEMPLATE_VIS is_base_of + : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Bp, class _Dp> +inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_BASE_OF_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.h new file mode 100644 index 0000000000..f6e800d723 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_bounded_array.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_BOUNDED_ARRAY_H +#define _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_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 + +#if _LIBCPP_STD_VER > 17 + +template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {}; + +template <class _Tp> +inline constexpr +bool is_bounded_array_v = is_bounded_array<_Tp>::value; + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h new file mode 100644 index 0000000000..523dc493e8 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_class.h @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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_CLASS_H +#define _LIBCPP___TYPE_TRAITS_IS_CLASS_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_union.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 __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; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CLASS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.h new file mode 100644 index 0000000000..a53aa5c8f1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_compound.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___TYPE_TRAITS_IS_COMPOUND_H +#define _LIBCPP___TYPE_TRAITS_IS_COMPOUND_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_fundamental.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_compound_v = __is_compound(_Tp); +#endif + +#else // __has_keyword(__is_compound) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound + : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_compound_v = is_compound<_Tp>::value; +#endif + +#endif // __has_keyword(__is_compound) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_COMPOUND_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_const.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_const.h new file mode 100644 index 0000000000..63088229b1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_const.h @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// 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_CONST_H +#define _LIBCPP___TYPE_TRAITS_IS_CONST_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_const) && !defined(__CUDACC__) + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_const_v = __is_const(_Tp); +#endif + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_const_v = is_const<_Tp>::value; +#endif + +#endif // __has_keyword(__is_const) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CONST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_convertible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_convertible.h new file mode 100644 index 0000000000..884e808e2a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_convertible.h @@ -0,0 +1,108 @@ +//===----------------------------------------------------------------------===// +// +// 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_CONVERTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_void.h> +#include <__type_traits/remove_reference.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 __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + +template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible + : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {}; + +#else // __has_feature(is_convertible_to) + +namespace __is_convertible_imp +{ +template <class _Tp> void __test_convert(_Tp); + +template <class _From, class _To, class = void> +struct __is_convertible_test : public false_type {}; + +template <class _From, class _To> +struct __is_convertible_test<_From, _To, + decltype(__is_convertible_imp::__test_convert<_To>(declval<_From>()))> : public true_type +{}; + +template <class _Tp, bool _IsArray = is_array<_Tp>::value, + bool _IsFunction = is_function<_Tp>::value, + bool _IsVoid = is_void<_Tp>::value> + struct __is_array_function_or_void {enum {value = 0};}; +template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; +template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; +template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; +} + +template <class _Tp, + unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> +struct __is_convertible_check +{ + static const size_t __v = 0; +}; + +template <class _Tp> +struct __is_convertible_check<_Tp, 0> +{ + static const size_t __v = sizeof(_Tp); +}; + +template <class _T1, class _T2, + unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, + unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> +struct __is_convertible + : public integral_constant<bool, + __is_convertible_imp::__is_convertible_test<_T1, _T2>::value + > +{}; + +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; + +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; + +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; +template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; + +template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible + : public __is_convertible<_T1, _T2> +{ + static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; + static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; +}; + +#endif // __has_feature(is_convertible_to) + +#if _LIBCPP_STD_VER > 14 +template <class _From, class _To> +inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_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 new file mode 100644 index 0000000000..e81c6f7e2f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_empty.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_IS_EMPTY_H +#define _LIBCPP___TYPE_TRAITS_IS_EMPTY_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_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; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_EMPTY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h new file mode 100644 index 0000000000..ac160da84e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_enum.h @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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_ENUM_H +#define _LIBCPP___TYPE_TRAITS_IS_ENUM_H + +#include <__config> +#include <__type_traits/integral_constant.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 __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum + : public integral_constant<bool, __is_enum(_Tp)> {}; + +#if _LIBCPP_STD_VER > 14 +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 new file mode 100644 index 0000000000..f2d9b5b3c8 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_final.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_FINAL_H +#define _LIBCPP___TYPE_TRAITS_IS_FINAL_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 +__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS +is_final : public integral_constant<bool, __is_final(_Tp)> {}; +#endif + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_final_v = is_final<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_FINAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_floating_point.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_floating_point.h new file mode 100644 index 0000000000..d93e5d99d0 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_floating_point.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_FLOATING_POINT_H +#define _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; +template <> struct __libcpp_is_floating_point<float> : public true_type {}; +template <> struct __libcpp_is_floating_point<double> : public true_type {}; +template <> struct __libcpp_is_floating_point<long double> : public true_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point + : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.h new file mode 100644 index 0000000000..b5e63e4c37 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_function.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_IS_FUNCTIONAL_H +#define _LIBCPP___TYPE_TRAITS_IS_FUNCTIONAL_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_reference.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function + : public _BoolConstant< +#if defined(__clang__) && !defined(__CUDACC__) + __is_function(_Tp) +#else + !(is_reference<_Tp>::value || is_const<const _Tp>::value) +#endif + > {}; + + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_function_v = is_function<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_FUNCTIONAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.h new file mode 100644 index 0000000000..8590e9f82c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_fundamental.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_IS_FUNDAMENTAL_H +#define _LIBCPP___TYPE_TRAITS_IS_FUNDAMENTAL_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_null_pointer.h> +#include <__type_traits/is_void.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); +#endif + +#else // __has_keyword(__is_fundamental) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental + : public integral_constant<bool, is_void<_Tp>::value || + __is_nullptr_t<_Tp>::value || + is_arithmetic<_Tp>::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; +#endif + +#endif // __has_keyword(__is_fundamental) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_FUNDAMENTAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.h new file mode 100644 index 0000000000..f3ee5de8a5 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_integral.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___TYPE_TRAITS_IS_INTEGRAL_H +#define _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; }; +template <> struct __libcpp_is_integral<bool> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<char> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<signed char> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<unsigned char> { enum { value = 1 }; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; }; +#endif +#ifndef _LIBCPP_HAS_NO_CHAR8_T +template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; }; +#endif +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; }; +#endif +template <> struct __libcpp_is_integral<short> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<int> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<unsigned int> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<long> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<unsigned long> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<long long> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; }; +#ifndef _LIBCPP_HAS_NO_INT128 +template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; }; +template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; }; +#endif + +#if __has_keyword(__is_integral) && !defined(__CUDACC__) + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_integral_v = __is_integral(_Tp); +#endif + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral + : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_integral_v = is_integral<_Tp>::value; +#endif + +#endif // __has_keyword(__is_integral) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h new file mode 100644 index 0000000000..cd142d858e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_function_pointer.h @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H +#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_function.h> +#include <__type_traits/remove_cv.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct __libcpp_is_member_pointer { + enum { + __is_member = false, + __is_func = false, + __is_obj = false + }; +}; +template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> { + enum { + __is_member = true, + __is_func = is_function<_Tp>::value, + __is_obj = !__is_func, + }; +}; + +#if __has_keyword(__is_member_function_pointer) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer + : _BoolConstant<__is_member_function_pointer(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); +#endif + +#else // __has_keyword(__is_member_function_pointer) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer + : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; +#endif + +#endif // __has_keyword(__is_member_function_pointer) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h new file mode 100644 index 0000000000..b4f8a24118 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_object_pointer.h @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_MEMBER_OBJECT_POINTER_H +#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_OBJECT_POINTER_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_keyword(__is_member_object_pointer) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer + : _BoolConstant<__is_member_object_pointer(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); +#endif + +#else // __has_keyword(__is_member_object_pointer) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer + : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; +#endif + +#endif // __has_keyword(__is_member_object_pointer) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h new file mode 100644 index 0000000000..168de5fd72 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_member_pointer.h @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H +#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_keyword(__is_member_pointer) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); +#endif + +#else // __has_keyword(__is_member_pointer) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer + : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; +#endif + +#endif // __has_keyword(__is_member_pointer) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.h new file mode 100644 index 0000000000..f81cb9aadb --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_null_pointer.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_IS_NULL_POINTER_H +#define _LIBCPP___TYPE_TRAITS_IS_NULL_POINTER_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_cv.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; +template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t + : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer + : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; +#endif +#endif // _LIBCPP_STD_VER > 11 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_NULL_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.h new file mode 100644 index 0000000000..912236655e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_object.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_OBJECT_H +#define _LIBCPP___TYPE_TRAITS_IS_OBJECT_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_class.h> +#include <__type_traits/is_scalar.h> +#include <__type_traits/is_union.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_keyword(__is_object) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_object_v = __is_object(_Tp); +#endif + +#else // __has_keyword(__is_object) + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object + : public integral_constant<bool, is_scalar<_Tp>::value || + is_array<_Tp>::value || + is_union<_Tp>::value || + is_class<_Tp>::value > {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_object_v = is_object<_Tp>::value; +#endif + +#endif // __has_keyword(__is_object) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_OBJECT_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 new file mode 100644 index 0000000000..585d5035b4 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_pointer.h @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_POINTER_H +#define _LIBCPP___TYPE_TRAITS_IS_POINTER_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_pointer_v = __is_pointer(_Tp); +#endif + +#else // __has_keyword(__is_pointer) + +template <class _Tp> struct __libcpp_is_pointer : public false_type {}; +template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; + +template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; }; +#if defined(_LIBCPP_HAS_OBJC_ARC) +template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; }; +template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; }; +template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; }; +template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; }; +#endif + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer + : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; +#endif + +#endif // __has_keyword(__is_pointer) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h new file mode 100644 index 0000000000..94cf887c4f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference.h @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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_REFERENCE_H +#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_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_lvalue_reference) && \ + __has_keyword(__is_rvalue_reference) && \ + __has_keyword(__is_reference) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { }; + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { }; + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_reference_v = __is_reference(_Tp); +template <class _Tp> +inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); +template <class _Tp> +inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); +#endif + +#else // __has_keyword(__is_lvalue_reference) && etc... + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_reference_v = is_reference<_Tp>::value; + +template <class _Tp> +inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; + +template <class _Tp> +inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; +#endif + +#endif // __has_keyword(__is_lvalue_reference) && etc... + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h new file mode 100644 index 0000000000..cd391bb07e --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_reference_wrapper.h @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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_REFERENCE_WRAPPER_H +#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_WRAPPER_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper; + +template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; +template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; +template <class _Tp> struct __is_reference_wrapper + : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ENABLE_IF_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 new file mode 100644 index 0000000000..6d98a3db99 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_referenceable.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_REFERENCEABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_same.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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> +struct __is_referenceable : integral_constant<bool, + _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_same.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_same.h new file mode 100644 index 0000000000..30087cc151 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_same.h @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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_SAME_H +#define _LIBCPP___TYPE_TRAITS_IS_SAME_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_same) && !defined(__CUDACC__) + +template <class _Tp, class _Up> +struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Up> +inline constexpr bool is_same_v = __is_same(_Tp, _Up); +#endif + +#else + +template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp, class _Up> +inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; +#endif + +#endif // __is_same +// _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types: +// is_same<A,B> and is_same<C,D> are guaranteed to be different types, but +// _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type). +// Neither GCC nor Clang can mangle the __is_same builtin, so _IsSame +// mustn't be directly used anywhere that contributes to name-mangling +// (such as in a dependent return type). + +template <class _Tp, class _Up> +using _IsSame = _BoolConstant< +#if defined(__clang__) && !defined(__CUDACC__) + __is_same(_Tp, _Up) +#else + is_same<_Tp, _Up>::value +#endif +>; + +template <class _Tp, class _Up> +using _IsNotSame = _BoolConstant< +#if defined(__clang__) && !defined(__CUDACC__) + !__is_same(_Tp, _Up) +#else + !is_same<_Tp, _Up>::value +#endif +>; + + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SAME_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h new file mode 100644 index 0000000000..c37ef5899f --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_scalar.h @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// 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_SCALAR_H +#define _LIBCPP___TYPE_TRAITS_IS_SCALAR_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_arithmetic.h> +#include <__type_traits/is_enum.h> +#include <__type_traits/is_member_pointer.h> +#include <__type_traits/is_pointer.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_scalar_v = __is_scalar(_Tp); +#endif + +#else // __has_keyword(__is_scalar) + +template <class _Tp> struct __is_block : false_type {}; +#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) +template <class _Rp, class ..._Args> struct __is_block<_Rp (^)(_Args...)> : true_type {}; +#endif + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar + : public integral_constant<bool, is_arithmetic<_Tp>::value || + is_member_pointer<_Tp>::value || + is_pointer<_Tp>::value || + __is_nullptr_t<_Tp>::value || + __is_block<_Tp>::value || + is_enum<_Tp>::value > {}; + +template <> struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; +#endif + +#endif // __has_keyword(__is_scalar) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SCALAR_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_signed.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_signed.h new file mode 100644 index 0000000000..71994097ed --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_signed.h @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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_SIGNED_H +#define _LIBCPP___TYPE_TRAITS_IS_SIGNED_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_signed) && !defined(__CUDACC__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_signed_v = __is_signed(_Tp); +#endif + +#else // __has_keyword(__is_signed) + +template <class _Tp, bool = is_integral<_Tp>::value> +struct __libcpp_is_signed_impl : public _BoolConstant<(_Tp(-1) < _Tp(0))> {}; + +template <class _Tp> +struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point + +template <class _Tp, bool = is_arithmetic<_Tp>::value> +struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; + +template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_signed_v = is_signed<_Tp>::value; +#endif + +#endif // __has_keyword(__is_signed) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SIGNED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.h new file mode 100644 index 0000000000..9e857533c6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unbounded_array.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_UNBOUNDED_ARRAY_H +#define _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_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 _LIBCPP_STD_VER > 17 + +template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {}; + +template <class _Tp> +inline constexpr +bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_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 new file mode 100644 index 0000000000..d02931fc01 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_union.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_UNION_H +#define _LIBCPP___TYPE_TRAITS_IS_UNION_H + +#include <__config> +#include <__type_traits/integral_constant.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 __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; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_UNION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h new file mode 100644 index 0000000000..69baa17b0a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_unsigned.h @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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_UNSIGNED_H +#define _LIBCPP___TYPE_TRAITS_IS_UNSIGNED_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_arithmetic.h> +#include <__type_traits/is_integral.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_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__) + +template<class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); +#endif + +#else // __has_keyword(__is_unsigned) + +template <class _Tp, bool = is_integral<_Tp>::value> +struct __libcpp_is_unsigned_impl : public _BoolConstant<(_Tp(0) < _Tp(-1))> {}; + +template <class _Tp> +struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point + +template <class _Tp, bool = is_arithmetic<_Tp>::value> +struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; + +template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; +#endif + +#endif // __has_keyword(__is_unsigned) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_UNSIGNED_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h new file mode 100644 index 0000000000..af8dbada04 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_void.h @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// 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_VOID_H +#define _LIBCPP___TYPE_TRAITS_IS_VOID_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_void) && !defined(__CUDACC__) + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_void_v = __is_void(_Tp); +#endif + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void + : public is_same<typename remove_cv<_Tp>::type, void> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_void_v = is_void<_Tp>::value; +#endif + +#endif // __has_keyword(__is_void) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_VOID_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_volatile.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_volatile.h new file mode 100644 index 0000000000..cee3c1cb87 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_volatile.h @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// 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_VOLATILE_H +#define _LIBCPP___TYPE_TRAITS_IS_VOLATILE_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_volatile) && !defined(__CUDACC__) + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_volatile_v = __is_volatile(_Tp); +#endif + +#else + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; +#endif + +#endif // __has_keyword(__is_volatile) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_VOLATILE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.h new file mode 100644 index 0000000000..193d3fd129 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/rank.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_RANK_H +#define _LIBCPP___TYPE_TRAITS_RANK_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 rank + : public integral_constant<size_t, 0> {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> + : public integral_constant<size_t, rank<_Tp>::value + 1> {}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> + : public integral_constant<size_t, rank<_Tp>::value + 1> {}; + +#if _LIBCPP_STD_VER > 14 +template <class _Tp> +inline constexpr size_t rank_v = rank<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_RANK_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.h new file mode 100644 index 0000000000..075e3acabb --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_all_extents.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_REMOVE_ALL_EXTENTS_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_ALL_EXTENTS_H + +#include <__config> +#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 remove_all_extents + {typedef _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]> + {typedef typename remove_all_extents<_Tp>::type type;}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]> + {typedef typename remove_all_extents<_Tp>::type type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_ALL_EXTENTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_const.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_const.h new file mode 100644 index 0000000000..8efc893e96 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_const.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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_REMOVE_CONST_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_CONST_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;}; +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CONST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h new file mode 100644 index 0000000000..ce1e4e45c6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_cv.h @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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_REMOVE_CV_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_CV_H + +#include <__config> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_volatile.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 remove_cv +{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CV_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.h new file mode 100644 index 0000000000..e353de3616 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_extent.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_REMOVE_EXTENT_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H + +#include <__config> +#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 remove_extent + {typedef _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]> + {typedef _Tp type;}; +template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]> + {typedef _Tp type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_pointer.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_pointer.h new file mode 100644 index 0000000000..50cde38294 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_pointer.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_REMOVE_POINTER_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_POINTER_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_POINTER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_reference.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_reference.h new file mode 100644 index 0000000000..a69e48dc58 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_reference.h @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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_REMOVE_REFERENCE_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H + +#include <__config> +#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 remove_reference {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;}; + +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_volatile.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_volatile.h new file mode 100644 index 0000000000..79f64c46a2 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/remove_volatile.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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_REMOVE_VOLATILE_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_VOLATILE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;}; +#if _LIBCPP_STD_VER > 11 +template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_VOLATILE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_identity.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_identity.h new file mode 100644 index 0000000000..42e52b1672 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/type_identity.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_TYPE_IDENTITY_H +#define _LIBCPP___TYPE_TRAITS_TYPE_IDENTITY_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct __type_identity { typedef _Tp type; }; + +template <class _Tp> +using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; + +#if _LIBCPP_STD_VER > 17 +template<class _Tp> struct type_identity { typedef _Tp type; }; +template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_TYPE_IDENTITY_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__undef_macros b/contrib/libs/cxxsupp/libcxx/include/__undef_macros index 40b2b64d0a..3bacbbacb5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__undef_macros +++ b/contrib/libs/cxxsupp/libcxx/include/__undef_macros @@ -7,27 +7,10 @@ // //===----------------------------------------------------------------------===// - #ifdef min -#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_WARNING) -_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " - "before any Windows header. #undefing min") -#else -#warning: macro min is incompatible with C++. #undefing min -#endif -#endif -#undef min +# undef min #endif #ifdef max -#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_WARNING) -_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " - "before any Windows header. #undefing max") -#else -#warning: macro max is incompatible with C++. #undefing max -#endif -#endif -#undef max +# undef max #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h index 7d1c8c2522..da0d986093 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h @@ -26,15 +26,10 @@ move(_Tp&& __t) _NOEXCEPT { return static_cast<_Up&&>(__t); } -#ifndef _LIBCPP_CXX03_LANG template <class _Tp> using __move_if_noexcept_result_t = typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>::type; -#else // _LIBCPP_CXX03_LANG -template <class _Tp> -using __move_if_noexcept_result_t = const _Tp&; -#endif template <class _Tp> _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/algorithm b/contrib/libs/cxxsupp/libcxx/include/algorithm index c30e3a6ce9..4718451e2e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/algorithm +++ b/contrib/libs/cxxsupp/libcxx/include/algorithm @@ -45,6 +45,15 @@ namespace ranges { indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template <input_iterator I1, sentinel_for<_I1> S1, input_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> @@ -265,6 +274,77 @@ namespace ranges { indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S> + requires permutable<I> + constexpr I ranges::reverse(I first, S last); // since C++20 + + template<bidirectional_range R> + requires permutable<iterator_t<R>> + constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 + + template<class T, output_iterator<const T&> O, sentinel_for<O> S> + constexpr O ranges::fill(O first, S last, const T& value); // since C++20 + + template<class T, output_range<const T&> R> + constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 + + template<class T, output_iterator<const T&> O> + constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_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 bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_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 bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + 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 } constexpr bool // constexpr in C++20 @@ -981,18 +1061,25 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_all_of.h> +#include <__algorithm/ranges_any_of.h> #include <__algorithm/ranges_copy.h> #include <__algorithm/ranges_copy_backward.h> #include <__algorithm/ranges_copy_if.h> #include <__algorithm/ranges_copy_n.h> #include <__algorithm/ranges_count.h> #include <__algorithm/ranges_count_if.h> +#include <__algorithm/ranges_equal.h> +#include <__algorithm/ranges_fill.h> +#include <__algorithm/ranges_fill_n.h> #include <__algorithm/ranges_find.h> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> #include <__algorithm/ranges_for_each.h> #include <__algorithm/ranges_for_each_n.h> #include <__algorithm/ranges_is_partitioned.h> +#include <__algorithm/ranges_is_sorted.h> +#include <__algorithm/ranges_is_sorted_until.h> #include <__algorithm/ranges_max.h> #include <__algorithm/ranges_max_element.h> #include <__algorithm/ranges_min.h> @@ -1000,6 +1087,8 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_minmax.h> #include <__algorithm/ranges_minmax_element.h> #include <__algorithm/ranges_mismatch.h> +#include <__algorithm/ranges_none_of.h> +#include <__algorithm/ranges_reverse.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> #include <__algorithm/remove.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/any b/contrib/libs/cxxsupp/libcxx/include/any index bd0ea5677d..308a49e810 100644 --- a/contrib/libs/cxxsupp/libcxx/include/any +++ b/contrib/libs/cxxsupp/libcxx/include/any @@ -664,6 +664,7 @@ _RetType __pointer_or_func_cast(void*, /*IsFunction*/true_type) noexcept { } template <class _ValueType> +_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any * __any) _NOEXCEPT { diff --git a/contrib/libs/cxxsupp/libcxx/include/barrier b/contrib/libs/cxxsupp/libcxx/include/barrier index 6f8a1f9f38..9d91d255df 100644 --- a/contrib/libs/cxxsupp/libcxx/include/barrier +++ b/contrib/libs/cxxsupp/libcxx/include/barrier @@ -50,16 +50,15 @@ namespace std #include <__config> #include <__thread/timed_backoff_policy.h> #include <atomic> -#ifndef _LIBCPP_HAS_NO_TREE_BARRIER -# include <memory> -#endif +#include <limits> +#include <memory> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #ifdef _LIBCPP_HAS_NO_THREADS -# error <barrier> is not supported on this single threaded system +# error "<barrier> is not supported since libc++ has been configured without support for threads." #endif _LIBCPP_PUSH_MACROS @@ -279,7 +278,7 @@ public: } }; -#endif //_LIBCPP_HAS_NO_TREE_BARRIER +#endif // !_LIBCPP_HAS_NO_TREE_BARRIER template<class _CompletionF = __empty_completion> class barrier { diff --git a/contrib/libs/cxxsupp/libcxx/include/cstddef b/contrib/libs/cxxsupp/libcxx/include/cstddef index fb7cb62860..5e3e99fb66 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cstddef +++ b/contrib/libs/cxxsupp/libcxx/include/cstddef @@ -35,6 +35,9 @@ Types: #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_integral.h> #include <stddef.h> #include <version> @@ -56,34 +59,6 @@ using ::size_t _LIBCPP_USING_IF_EXISTS; using ::max_align_t _LIBCPP_USING_IF_EXISTS; #endif -template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; }; -template <> struct __libcpp_is_integral<bool> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<char> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<signed char> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<unsigned char> { enum { value = 1 }; }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; }; -#endif -#ifndef _LIBCPP_HAS_NO_CHAR8_T -template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; }; -#endif -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS -template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; }; -#endif -template <> struct __libcpp_is_integral<short> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<int> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<unsigned int> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<long> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<unsigned long> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<long long> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; }; -#ifndef _LIBCPP_HAS_NO_INT128 -template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; }; -template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; }; -#endif - _LIBCPP_END_NAMESPACE_STD #if _LIBCPP_STD_VER > 14 @@ -91,11 +66,6 @@ namespace std // purposefully not versioned { enum class byte : unsigned char {}; - -template <bool> struct __enable_if_integral_imp {}; -template <> struct __enable_if_integral_imp<true> { using type = byte; }; -template <class _Tp> using _EnableByteOverload = typename __enable_if_integral_imp<__libcpp_is_integral<_Tp>::value>::type; - constexpr byte operator| (byte __lhs, byte __rhs) noexcept { return static_cast<byte>( @@ -136,6 +106,10 @@ constexpr byte operator~ (byte __b) noexcept ~static_cast<unsigned int>(__b) )); } + +template <class _Tp> +using _EnableByteOverload = __enable_if_t<is_integral<_Tp>::value, byte>; + template <class _Integer> constexpr _EnableByteOverload<_Integer> & operator<<=(byte& __lhs, _Integer __shift) noexcept diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index c23cac9828..fd20ec4457 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -261,7 +261,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct #include <version> #if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) -# error "The Filesystem library is not supported since libc++ has been configured with LIBCXX_ENABLE_FILESYSTEM disabled" +# error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem." #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index 55ce2b18a9..98fa0b0346 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -309,6 +309,9 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt } } +// The function is _LIBCPP_ALWAYS_INLINE since the compiler is bad at inlining +// https://reviews.llvm.org/D110499#inline-1180704 +// TODO FMT Evaluate whether we want to file a Clang bug report regarding this. template <output_iterator<const char&> _OutIt> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { @@ -369,31 +372,27 @@ format(wstring_view __fmt, const _Args&... __args) { } #endif +template <class _Context, class _OutIt, class _CharT> +_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, + basic_string_view<_CharT> __fmt, + basic_format_args<_Context> __args) { + __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; + _VSTD::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(__buffer.make_output_iterator(), __args)); + return _VSTD::move(__buffer).result(); +} + template <output_iterator<const char&> _OutIt, class... _Args> -_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) { - // TODO FMT Improve PoC: using std::string is inefficient. - string __str = _VSTD::vformat(__fmt, _VSTD::make_format_args(__args...)); - iter_difference_t<_OutIt> __s = __str.size(); - iter_difference_t<_OutIt> __m = - _VSTD::clamp(__n, iter_difference_t<_OutIt>(0), __s); - __out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it)); - return {_VSTD::move(__out_it), __s}; +_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...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_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) { - // TODO FMT Improve PoC: using std::string is inefficient. - wstring __str = _VSTD::vformat(__fmt, _VSTD::make_wformat_args(__args...)); - iter_difference_t<_OutIt> __s = __str.size(); - iter_difference_t<_OutIt> __m = - _VSTD::clamp(__n, iter_difference_t<_OutIt>(0), __s); - __out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it)); - return {_VSTD::move(__out_it), __s}; +_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...)); } #endif @@ -507,33 +506,30 @@ format(locale __loc, wstring_view __fmt, const _Args&... __args) { } #endif +template <class _Context, class _OutIt, class _CharT> +_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, + locale __loc, basic_string_view<_CharT> __fmt, + basic_format_args<_Context> __args) { + __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{_VSTD::move(__out_it), __n}; + _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(__buffer.make_output_iterator(), __args, _VSTD::move(__loc))); + return _VSTD::move(__buffer).result(); +} + template <output_iterator<const char&> _OutIt, class... _Args> -_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) { - // TODO FMT Improve PoC: using std::string is inefficient. - string __str = _VSTD::vformat(_VSTD::move(__loc), __fmt, - _VSTD::make_format_args(__args...)); - iter_difference_t<_OutIt> __s = __str.size(); - iter_difference_t<_OutIt> __m = - _VSTD::clamp(__n, iter_difference_t<_OutIt>(0), __s); - __out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it)); - return {_VSTD::move(__out_it), __s}; +_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, + _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> -format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, - wstring_view __fmt, const _Args&... __args) { - // TODO FMT Improve PoC: using std::string is inefficient. - wstring __str = _VSTD::vformat(_VSTD::move(__loc), __fmt, - _VSTD::make_wformat_args(__args...)); - iter_difference_t<_OutIt> __s = __str.size(); - iter_difference_t<_OutIt> __m = - _VSTD::clamp(__n, iter_difference_t<_OutIt>(0), __s); - __out_it = _VSTD::copy_n(__str.begin(), __m, _VSTD::move(__out_it)); - return {_VSTD::move(__out_it), __s}; +_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, + _VSTD::make_wformat_args(__args...)); } #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/future b/contrib/libs/cxxsupp/libcxx/include/future index b397477922..4f49bf158b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/future +++ b/contrib/libs/cxxsupp/libcxx/include/future @@ -383,8 +383,8 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; #endif #ifdef _LIBCPP_HAS_NO_THREADS -#error <future> is not supported on this single threaded system -#else // !_LIBCPP_HAS_NO_THREADS +# error "<future> is not supported since libc++ has been configured without support for threads." +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -2432,6 +2432,4 @@ future<void>::share() _NOEXCEPT _LIBCPP_END_NAMESPACE_STD -#endif // !_LIBCPP_HAS_NO_THREADS - #endif // _LIBCPP_FUTURE diff --git a/contrib/libs/cxxsupp/libcxx/include/ios b/contrib/libs/cxxsupp/libcxx/include/ios index a790ba5c17..d1b8c43a8a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ios +++ b/contrib/libs/cxxsupp/libcxx/include/ios @@ -210,8 +210,13 @@ storage-class-specifier const error_category& iostream_category() noexcept; */ -#include <__assert> // all public C++ headers provide the assertion handler #include <__config> + +#if defined(_LIBCPP_HAS_NO_LOCALIZATION) +# error "The iostreams library is not supported since libc++ has been configured without support for localization." +#endif + +#include <__assert> // all public C++ headers provide the assertion handler #include <__ios/fpos.h> #include <__locale> #include <__utility/swap.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/iterator b/contrib/libs/cxxsupp/libcxx/include/iterator index 1f0390e83a..30c9a10139 100644 --- a/contrib/libs/cxxsupp/libcxx/include/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/iterator @@ -386,12 +386,13 @@ constexpr insert_iterator<Container> inserter(Container& x, ranges::iterator_t<C template <class Iterator> class move_iterator { public: - typedef Iterator iterator_type; - typedef typename iterator_traits<Iterator>::difference_type difference_type; - typedef Iterator pointer; - typedef typename iterator_traits<Iterator>::value_type value_type; - typedef typename iterator_traits<Iterator>::iterator_category iterator_category; - typedef value_type&& reference; + using iterator_type = Iterator; + using iterator_concept = input_iterator_tag; // From C++20 + using iterator_category = see below; // not always present starting from C++20 + using value_type = iter_value_t<Iterator>; // Until C++20, iterator_traits<Iterator>::value_type + using difference_type = iter_difference_t<Iterator>; // Until C++20, iterator_traits<Iterator>::difference_type; + using pointer = Iterator; + using reference = iter_rvalue_reference_t<Iterator>; // Until C++20, value_type&& constexpr move_iterator(); // all the constexprs are in C++17 constexpr explicit move_iterator(Iterator i); @@ -399,18 +400,40 @@ public: constexpr move_iterator(const move_iterator<U>& u); template <class U> constexpr move_iterator& operator=(const move_iterator<U>& u); - constexpr iterator_type base() const; + + constexpr iterator_type base() const; // Until C++20 + constexpr const Iterator& base() const & noexcept; // From C++20 + constexpr Iterator base() &&; // From C++20 + constexpr reference operator*() const; - constexpr pointer operator->() const; + constexpr pointer operator->() const; // Removed in C++20 constexpr move_iterator& operator++(); - constexpr move_iterator operator++(int); + constexpr auto operator++(int); // Return type was move_iterator until C++20 constexpr move_iterator& operator--(); constexpr move_iterator operator--(int); constexpr move_iterator operator+(difference_type n) const; constexpr move_iterator& operator+=(difference_type n); constexpr move_iterator operator-(difference_type n) const; constexpr move_iterator& operator-=(difference_type n); - constexpr unspecified operator[](difference_type n) const; + constexpr reference operator[](difference_type n) const; // Return type unspecified until C++20 + + template<sentinel_for<Iterator> S> + friend constexpr bool + operator==(const move_iterator& x, const move_sentinel<S>& y); // Since C++20 + template<sized_sentinel_for<Iterator> S> + friend constexpr iter_difference_t<Iterator> + operator-(const move_sentinel<S>& x, const move_iterator& y); // Since C++20 + template<sized_sentinel_for<Iterator> S> + friend constexpr iter_difference_t<Iterator> + operator-(const move_iterator& x, const move_sentinel<S>& y); // Since C++20 + friend constexpr iter_rvalue_reference_t<Iterator> + iter_move(const move_iterator& i) + noexcept(noexcept(ranges::iter_move(i.current))); // Since C++20 + template<indirectly_swappable<Iterator> Iterator2> + friend constexpr void + iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y) + noexcept(noexcept(ranges::iter_swap(x.current, y.current))); // Since C++20 + private: Iterator current; // exposition only }; @@ -452,6 +475,23 @@ constexpr move_iterator<Iterator> operator+( // constexpr in C++17 template <class Iterator> // constexpr in C++17 constexpr move_iterator<Iterator> make_move_iterator(const Iterator& i); +template<semiregular S> +class move_sentinel { +public: + constexpr move_sentinel(); + constexpr explicit move_sentinel(S s); + template<class S2> + requires convertible_to<const S2&, S> + constexpr move_sentinel(const move_sentinel<S2>& s); + template<class S2> + requires assignable_from<S&, const S2&> + constexpr move_sentinel& operator=(const move_sentinel<S2>& s); + + constexpr S base() const; +private: + S last; // exposition only +}; + // [default.sentinel], default sentinel struct default_sentinel_t; inline constexpr default_sentinel_t default_sentinel{}; @@ -684,12 +724,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> #include <exception> diff --git a/contrib/libs/cxxsupp/libcxx/include/latch b/contrib/libs/cxxsupp/libcxx/include/latch index d6cb476222..85936750b4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/latch +++ b/contrib/libs/cxxsupp/libcxx/include/latch @@ -44,6 +44,7 @@ namespace std #include <__availability> #include <__config> #include <atomic> +#include <limits> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -51,7 +52,7 @@ namespace std #endif #ifdef _LIBCPP_HAS_NO_THREADS -# error <latch> is not supported on this single threaded system +# error "<latch> is not supported since libc++ has been configured without support for threads." #endif _LIBCPP_PUSH_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/locale b/contrib/libs/cxxsupp/libcxx/include/locale index d0302db58d..e1842d525d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale +++ b/contrib/libs/cxxsupp/libcxx/include/locale @@ -211,7 +211,7 @@ template <class charT> class messages_byname; #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. -# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) # define _LIBCPP_HAS_CATOPEN 1 # include <nl_types.h> # endif diff --git a/contrib/libs/cxxsupp/libcxx/include/locale.h b/contrib/libs/cxxsupp/libcxx/include/locale.h index 83b4bdfead..03d5783048 100644 --- a/contrib/libs/cxxsupp/libcxx/include/locale.h +++ b/contrib/libs/cxxsupp/libcxx/include/locale.h @@ -36,7 +36,7 @@ Functions: #include <__config> #if defined(_LIBCPP_HAS_NO_LOCALIZATION) -# error "The Localization library is not supported since libc++ has been configured with LIBCXX_ENABLE_LOCALIZATION disabled" +# error "<locale.h> is not supported since libc++ has been configured without support for localization." #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map index 46a00a0b10..ed4b0b91c7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/map +++ b/contrib/libs/cxxsupp/libcxx/include/map @@ -532,7 +532,9 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20 #include <__algorithm/lexicographical_compare.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/binary_function.h> #include <__functional/is_transparent.h> +#include <__functional/operations.h> #include <__iterator/iterator_traits.h> #include <__node_handle> #include <__tree> diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index 1c8acae385..5b6fda6988 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -873,14 +873,6 @@ template<size_t N, class T> #include <typeinfo> #include <version> -// TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> - #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) # include <__memory/auto_ptr.h> #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index 9adfccff7d..bc004351b6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -93,11 +93,11 @@ namespace std { template <class U, class... Args> constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...); template <class U = T> - constexpr EXPLICIT optional(U &&); + constexpr explicit(see-below) optional(U &&); template <class U> - EXPLICIT optional(const optional<U> &); // constexpr in C++20 + explicit(see-below) optional(const optional<U> &); // constexpr in C++20 template <class U> - EXPLICIT optional(optional<U> &&); // constexpr in C++20 + explicit(see-below) optional(optional<U> &&); // constexpr in C++20 // 23.6.3.2, destructor ~optional(); // constexpr in C++20 diff --git a/contrib/libs/cxxsupp/libcxx/include/queue b/contrib/libs/cxxsupp/libcxx/include/queue index bd3a39f494..da5d63077b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/queue +++ b/contrib/libs/cxxsupp/libcxx/include/queue @@ -222,6 +222,7 @@ template <class T, class Container, class Compare> #include <__algorithm/push_heap.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/operations.h> #include <__iterator/iterator_traits.h> #include <__memory/uses_allocator.h> #include <__utility/forward.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/semaphore b/contrib/libs/cxxsupp/libcxx/include/semaphore index b174eba34d..228cf773f0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/semaphore +++ b/contrib/libs/cxxsupp/libcxx/include/semaphore @@ -52,6 +52,7 @@ using binary_semaphore = counting_semaphore<1>; #include <__thread/timed_backoff_policy.h> #include <__threading_support> #include <atomic> +#include <limits> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -59,7 +60,7 @@ using binary_semaphore = counting_semaphore<1>; #endif #ifdef _LIBCPP_HAS_NO_THREADS -# error <semaphore> is not supported on this single threaded system +# error "<semaphore> is not supported since libc++ has been configured without support for threads." #endif _LIBCPP_PUSH_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set index b764bbaf0d..ccf9542cac 100644 --- a/contrib/libs/cxxsupp/libcxx/include/set +++ b/contrib/libs/cxxsupp/libcxx/include/set @@ -476,6 +476,7 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/is_transparent.h> +#include <__functional/operations.h> #include <__iterator/iterator_traits.h> #include <__node_handle> #include <__tree> diff --git a/contrib/libs/cxxsupp/libcxx/include/shared_mutex b/contrib/libs/cxxsupp/libcxx/include/shared_mutex index 68a2bbae0f..a089aa9fa8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/shared_mutex +++ b/contrib/libs/cxxsupp/libcxx/include/shared_mutex @@ -140,8 +140,8 @@ _LIBCPP_PUSH_MACROS #endif #ifdef _LIBCPP_HAS_NO_THREADS -#error <shared_mutex> is not supported on this single threaded system -#else // !_LIBCPP_HAS_NO_THREADS +# error "<shared_mutex> is not supported since libc++ has been configured without support for threads." +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -501,8 +501,6 @@ swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT _LIBCPP_END_NAMESPACE_STD -#endif // !_LIBCPP_HAS_NO_THREADS - #endif // _LIBCPP_STD_VER > 11 _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/span b/contrib/libs/cxxsupp/libcxx/include/span index 75d00c14bf..0b73a1ecf6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/span +++ b/contrib/libs/cxxsupp/libcxx/include/span @@ -138,6 +138,7 @@ template<class R> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> +#include <__utility/forward.h> #include <array> // for array #include <cstddef> // for byte #include <iterator> // for iterators diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index 3602fc046a..e114b28a6e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -524,6 +524,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <__config> #include <__debug> #include <__format/enable_insertable.h> +#include <__functional/unary_function.h> #include <__ios/fpos.h> #include <__iterator/wrap_iter.h> #include <__memory/allocate_at_least.h> @@ -547,12 +548,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> #include <new> #include <typeinfo> diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index 28fbe1a5f7..aa1a7942a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -199,6 +199,7 @@ namespace std { #include <__algorithm/min.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/unary_function.h> #include <__fwd/string_view.h> #include <__ranges/concepts.h> #include <__ranges/data.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index 837ee4a997..20708f119c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -105,8 +105,8 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> #ifdef _LIBCPP_HAS_NO_THREADS -#error <thread> is not supported on this single threaded system -#else // !_LIBCPP_HAS_NO_THREADS +# error "<thread> is not supported since libc++ has been configured without support for threads." +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -401,8 +401,6 @@ void yield() _NOEXCEPT {__libcpp_thread_yield();} _LIBCPP_END_NAMESPACE_STD -#endif // !_LIBCPP_HAS_NO_THREADS - _LIBCPP_POP_MACROS #endif // _LIBCPP_THREAD diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index a34c19abfe..cbafce78c6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -185,12 +185,6 @@ template <class... Types> #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> #include <exception> #include <new> #include <typeinfo> diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index 1337892256..8c192b78a4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -418,12 +418,64 @@ namespace std */ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#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/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/extent.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_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_convertible.h> +#include <__type_traits/is_empty.h> +#include <__type_traits/is_enum.h> +#include <__type_traits/is_final.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_fundamental.h> +#include <__type_traits/is_integral.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_null_pointer.h> +#include <__type_traits/is_object.h> +#include <__type_traits/is_pointer.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_signed.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/rank.h> +#include <__type_traits/remove_all_extents.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_extent.h> +#include <__type_traits/remove_pointer.h> +#include <__type_traits/remove_reference.h> +#include <__type_traits/remove_volatile.h> +#include <__type_traits/type_identity.h> #include <__utility/declval.h> #include <cstddef> #include <version> -#include <__utility/declval.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -436,18 +488,8 @@ namespace std _LIBCPP_BEGIN_NAMESPACE_STD template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair; -template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; -template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;}; - -template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; - -#if _LIBCPP_STD_VER > 11 -template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; -#endif - template <bool> struct _MetaBase; template <> struct _MetaBase<true> { @@ -532,65 +574,8 @@ struct __void_t { typedef void type; }; template <class _Tp, bool> struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; - -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; -#endif - // is_same -#if __has_keyword(__is_same) && !defined(__CUDACC__) - -template <class _Tp, class _Up> -struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Up> -inline constexpr bool is_same_v = __is_same(_Tp, _Up); -#endif - -#else - -template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Up> -inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; -#endif - -#endif // __is_same -// _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types: -// is_same<A,B> and is_same<C,D> are guaranteed to be different types, but -// _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type). -// Neither GCC nor Clang can mangle the __is_same builtin, so _IsSame -// mustn't be directly used anywhere that contributes to name-mangling -// (such as in a dependent return type). - -template <class _Tp, class _Up> -using _IsSame = _BoolConstant< -#if defined(__clang__) && !defined(__CUDACC__) - __is_same(_Tp, _Up) -#else - is_same<_Tp, _Up>::value -#endif ->; - -template <class _Tp, class _Up> -using _IsNotSame = _BoolConstant< -#if defined(__clang__) && !defined(__CUDACC__) - !__is_same(_Tp, _Up) -#else - !is_same<_Tp, _Up>::value -#endif ->; - - template <class _Tp> using __test_for_primary_template = __enable_if_t< _IsSame<_Tp, typename _Tp::__primary_template>::value @@ -600,148 +585,8 @@ using __is_primary_template = _IsValidExpansion< __test_for_primary_template, _Tp >; -// helper class - -struct __two {char __lx[2];}; - -// is_const - -#if __has_keyword(__is_const) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_const_v = __is_const(_Tp); -#endif - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_const_v = is_const<_Tp>::value; -#endif - -#endif // __has_keyword(__is_const) - -// is_volatile - -#if __has_keyword(__is_volatile) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_volatile_v = __is_volatile(_Tp); -#endif - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; -#endif - -#endif // __has_keyword(__is_volatile) - -// remove_const - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;}; -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; -#endif - -// remove_volatile - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;}; -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; -#endif - -// remove_cv - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv -{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; -#endif - -// is_void - -#if __has_keyword(__is_void) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_void_v = __is_void(_Tp); -#endif - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void - : public is_same<typename remove_cv<_Tp>::type, void> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_void_v = is_void<_Tp>::value; -#endif - -#endif // __has_keyword(__is_void) - -// __is_nullptr_t - -template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; -template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t - : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer - : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; -#endif -#endif // _LIBCPP_STD_VER > 11 - // is_integral -#if __has_keyword(__is_integral) && !defined(__CUDACC__) - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_integral_v = __is_integral(_Tp); -#endif - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral - : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_integral_v = is_integral<_Tp>::value; -#endif - -#endif // __has_keyword(__is_integral) - // [basic.fundamental] defines five standard signed integer types; // __int128_t is an extended signed integer type. // The signed and unsigned integer types, plus bool and the @@ -767,534 +612,6 @@ template <> struct __libcpp_is_unsigned_integer<unsigned long long> : public tru template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type {}; #endif -// is_floating_point -// <concepts> implements __libcpp_floating_point - -template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; -template <> struct __libcpp_is_floating_point<float> : public true_type {}; -template <> struct __libcpp_is_floating_point<double> : public true_type {}; -template <> struct __libcpp_is_floating_point<long double> : public true_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point - : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; -#endif - -// is_array - -// TODO: Clang incorrectly reports that __is_array is true for T[0]. -// Re-enable the branch once https://llvm.org/PR54705 is fixed. -#if __has_keyword(__is_array) && 0 - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_array_v = __is_array(_Tp); -#endif - -#else - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array - : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> - : public true_type {}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> - : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_array_v = is_array<_Tp>::value; -#endif - -#endif // __has_keyword(__is_array) - -// is_pointer - -// 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__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_pointer_v = __is_pointer(_Tp); -#endif - -#else // __has_keyword(__is_pointer) - -template <class _Tp> struct __libcpp_is_pointer : public false_type {}; -template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; - -template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; }; -#if defined(_LIBCPP_HAS_OBJC_ARC) -template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; }; -template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; }; -template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; }; -template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; }; -#endif - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer - : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; -#endif - -#endif // __has_keyword(__is_pointer) - -// is_reference - -#if __has_keyword(__is_lvalue_reference) && \ - __has_keyword(__is_rvalue_reference) && \ - __has_keyword(__is_reference) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { }; - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { }; - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_reference_v = __is_reference(_Tp); -template <class _Tp> -inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); -template <class _Tp> -inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); -#endif - -#else // __has_keyword(__is_lvalue_reference) && etc... - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_reference_v = is_reference<_Tp>::value; - -template <class _Tp> -inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; - -template <class _Tp> -inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; -#endif - -#endif // __has_keyword(__is_lvalue_reference) && etc... - -// is_union - -#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; -#endif - -// is_class - -#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; -#endif - -// is_function - -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning(push) -#pragma warning(disable: 4180) -#endif - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function - : public _BoolConstant< -#if defined(__clang__) && !defined(__CUDACC__) - __is_function(_Tp) -#else - !(is_reference<_Tp>::value || is_const<const _Tp>::value) -#endif - > {}; - -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning(pop) -#endif - - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_function_v = is_function<_Tp>::value; -#endif - -template <class _Tp> struct __libcpp_is_member_pointer { - enum { - __is_member = false, - __is_func = false, - __is_obj = false - }; -}; -template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> { - enum { - __is_member = true, - __is_func = is_function<_Tp>::value, - __is_obj = !__is_func, - }; -}; - -#if __has_keyword(__is_member_function_pointer) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer - : _BoolConstant<__is_member_function_pointer(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); -#endif - -#else // __has_keyword(__is_member_function_pointer) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer - : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; -#endif - -#endif // __has_keyword(__is_member_function_pointer) - -// is_member_pointer - -#if __has_keyword(__is_member_pointer) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); -#endif - -#else // __has_keyword(__is_member_pointer) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer - : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; -#endif - -#endif // __has_keyword(__is_member_pointer) - -// is_member_object_pointer - -#if __has_keyword(__is_member_object_pointer) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer - : _BoolConstant<__is_member_object_pointer(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); -#endif - -#else // __has_keyword(__is_member_object_pointer) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer - : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; -#endif - -#endif // __has_keyword(__is_member_object_pointer) - -// is_enum - -#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)> {}; - -#if _LIBCPP_STD_VER > 14 -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) - -// is_arithmetic - - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_arithmetic - : public integral_constant<bool, is_integral<_Tp>::value || - is_floating_point<_Tp>::value> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; -#endif - -// is_fundamental - -// 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__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); -#endif - -#else // __has_keyword(__is_fundamental) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental - : public integral_constant<bool, is_void<_Tp>::value || - __is_nullptr_t<_Tp>::value || - is_arithmetic<_Tp>::value> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; -#endif - -#endif // __has_keyword(__is_fundamental) - -// is_scalar - -// 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__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_scalar_v = __is_scalar(_Tp); -#endif - -#else // __has_keyword(__is_scalar) - -template <class _Tp> struct __is_block : false_type {}; -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) -template <class _Rp, class ..._Args> struct __is_block<_Rp (^)(_Args...)> : true_type {}; -#endif - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar - : public integral_constant<bool, is_arithmetic<_Tp>::value || - is_member_pointer<_Tp>::value || - is_pointer<_Tp>::value || - __is_nullptr_t<_Tp>::value || - __is_block<_Tp>::value || - is_enum<_Tp>::value > {}; - -template <> struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; -#endif - -#endif // __has_keyword(__is_scalar) - -// is_object - -#if __has_keyword(__is_object) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_object_v = __is_object(_Tp); -#endif - -#else // __has_keyword(__is_object) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object - : public integral_constant<bool, is_scalar<_Tp>::value || - is_array<_Tp>::value || - is_union<_Tp>::value || - is_class<_Tp>::value > {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_object_v = is_object<_Tp>::value; -#endif - -#endif // __has_keyword(__is_object) - -// is_compound - -// >= 11 because in C++03 nullptr isn't actually nullptr -#if __has_keyword(__is_compound) && !defined(_LIBCPP_CXX03_LANG) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_compound_v = __is_compound(_Tp); -#endif - -#else // __has_keyword(__is_compound) - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound - : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_compound_v = is_compound<_Tp>::value; -#endif - -#endif // __has_keyword(__is_compound) - -// __is_referenceable [defns.referenceable] - -struct __is_referenceable_impl { - template <class _Tp> static _Tp& __test(int); - template <class _Tp> static __two __test(...); -}; - -template <class _Tp> -struct __is_referenceable : integral_constant<bool, - _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {}; - - -// add_const - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const { - typedef _LIBCPP_NODEBUG const _Tp type; -}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_const_t = typename add_const<_Tp>::type; -#endif - -// add_volatile - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile { - typedef _LIBCPP_NODEBUG volatile _Tp type; -}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; -#endif - -// add_cv -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv { - typedef _LIBCPP_NODEBUG const volatile _Tp type; -}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; -#endif - -// remove_reference - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; -#endif - -// add_lvalue_reference - -template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; -template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp& type; }; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference -{typedef _LIBCPP_NODEBUG typename __add_lvalue_reference_impl<_Tp>::type type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; -#endif - -template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; -template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp&& type; }; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference -{typedef _LIBCPP_NODEBUG typename __add_rvalue_reference_impl<_Tp>::type type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; -#endif - template <class _Tp> struct __unconstref { typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type; @@ -1325,296 +642,6 @@ struct __any __any(...); }; -// remove_pointer - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; -#endif - -// add_pointer - -template <class _Tp, - bool = __is_referenceable<_Tp>::value || - _IsSame<typename remove_cv<_Tp>::type, void>::value> -struct __add_pointer_impl - {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;}; -template <class _Tp> struct __add_pointer_impl<_Tp, false> - {typedef _LIBCPP_NODEBUG _Tp type;}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer - {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; -#endif - -// type_identity - -template <class _Tp> -struct __type_identity { typedef _Tp type; }; - -template <class _Tp> -using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; - -#if _LIBCPP_STD_VER > 17 -template<class _Tp> struct type_identity { typedef _Tp type; }; -template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; -#endif - -// is_signed - -#if __has_keyword(__is_signed) && !defined(__CUDACC__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_signed_v = __is_signed(_Tp); -#endif - -#else // __has_keyword(__is_signed) - -template <class _Tp, bool = is_integral<_Tp>::value> -struct __libcpp_is_signed_impl : public _BoolConstant<(_Tp(-1) < _Tp(0))> {}; - -template <class _Tp> -struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point - -template <class _Tp, bool = is_arithmetic<_Tp>::value> -struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; - -template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_signed_v = is_signed<_Tp>::value; -#endif - -#endif // __has_keyword(__is_signed) - -// is_unsigned - -// 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__) - -template<class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); -#endif - -#else // __has_keyword(__is_unsigned) - -template <class _Tp, bool = is_integral<_Tp>::value> -struct __libcpp_is_unsigned_impl : public _BoolConstant<(_Tp(0) < _Tp(-1))> {}; - -template <class _Tp> -struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point - -template <class _Tp, bool = is_arithmetic<_Tp>::value> -struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; - -template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; -#endif - -#endif // __has_keyword(__is_unsigned) - -// rank - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank - : public integral_constant<size_t, 0> {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> - : public integral_constant<size_t, rank<_Tp>::value + 1> {}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> - : public integral_constant<size_t, rank<_Tp>::value + 1> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr size_t rank_v = rank<_Tp>::value; -#endif - -// extent - -#if __has_keyword(__array_extent) && !defined(__CUDACC__) - -template<class _Tp, size_t _Dim = 0> -struct _LIBCPP_TEMPLATE_VIS extent - : integral_constant<size_t, __array_extent(_Tp, _Dim)> { }; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, unsigned _Ip = 0> -inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); -#endif - -#else // __has_keyword(__array_extent) - -template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TEMPLATE_VIS extent - : public integral_constant<size_t, 0> {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], 0> - : public integral_constant<size_t, 0> {}; -template <class _Tp, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], _Ip> - : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0> - : public integral_constant<size_t, _Np> {}; -template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> - : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, unsigned _Ip = 0> -inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; -#endif - -#endif // __has_keyword(__array_extent) - -// remove_extent - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent - {typedef _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]> - {typedef _Tp type;}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]> - {typedef _Tp type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; -#endif - -// remove_all_extents - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents - {typedef _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]> - {typedef typename remove_all_extents<_Tp>::type type;}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]> - {typedef typename remove_all_extents<_Tp>::type type;}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; -#endif - -#if _LIBCPP_STD_VER > 17 -// is_bounded_array - -template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {}; -template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {}; - -template <class _Tp> -inline constexpr -bool is_bounded_array_v = is_bounded_array<_Tp>::value; - -// is_unbounded_array - -template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {}; - -template <class _Tp> -inline constexpr -bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; -#endif - -// decay - -template <class _Up, bool> -struct __decay { - typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type; -}; - -template <class _Up> -struct __decay<_Up, true> { -public: - typedef _LIBCPP_NODEBUG typename conditional - < - is_array<_Up>::value, - typename remove_extent<_Up>::type*, - typename conditional - < - is_function<_Up>::value, - typename add_pointer<_Up>::type, - typename remove_cv<_Up>::type - >::type - >::type type; -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS decay -{ -private: - typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; -public: - typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type; -}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using decay_t = typename decay<_Tp>::type; -#endif - -// is_abstract - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract - : public integral_constant<bool, __is_abstract(_Tp)> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; -#endif - -// is_final - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS -__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS -is_final : public integral_constant<bool, __is_final(_Tp)> {}; -#endif - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_final_v = is_final<_Tp>::value; -#endif - -// is_aggregate -#if _LIBCPP_STD_VER > 14 - -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; - -#endif // _LIBCPP_STD_VER > 14 - -// is_base_of - -template <class _Bp, class _Dp> -struct _LIBCPP_TEMPLATE_VIS is_base_of - : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Bp, class _Dp> -inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value; -#endif - // __is_core_convertible // [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed. @@ -1630,87 +657,6 @@ struct __is_core_convertible<_Tp, _Up, decltype( static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() ) )> : public true_type {}; -// is_convertible - -#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) - -template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible - : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {}; - -#else // __has_feature(is_convertible_to) - -namespace __is_convertible_imp -{ -template <class _Tp> void __test_convert(_Tp); - -template <class _From, class _To, class = void> -struct __is_convertible_test : public false_type {}; - -template <class _From, class _To> -struct __is_convertible_test<_From, _To, - decltype(__is_convertible_imp::__test_convert<_To>(declval<_From>()))> : public true_type -{}; - -template <class _Tp, bool _IsArray = is_array<_Tp>::value, - bool _IsFunction = is_function<_Tp>::value, - bool _IsVoid = is_void<_Tp>::value> - struct __is_array_function_or_void {enum {value = 0};}; -template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; -template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; -template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; -} - -template <class _Tp, - unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> -struct __is_convertible_check -{ - static const size_t __v = 0; -}; - -template <class _Tp> -struct __is_convertible_check<_Tp, 0> -{ - static const size_t __v = sizeof(_Tp); -}; - -template <class _T1, class _T2, - unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, - unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> -struct __is_convertible - : public integral_constant<bool, - __is_convertible_imp::__is_convertible_test<_T1, _T2>::value - > -{}; - -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; - -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; - -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; -template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; - -template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible - : public __is_convertible<_T1, _T2> -{ - static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; - static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; -}; - -#endif // __has_feature(is_convertible_to) - -#if _LIBCPP_STD_VER > 14 -template <class _From, class _To> -inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; -#endif - // is_nothrow_convertible #if _LIBCPP_STD_VER > 17 @@ -1737,42 +683,6 @@ inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To #endif // _LIBCPP_STD_VER > 17 -// is_empty - -#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; -#endif - // is_polymorphic #if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC) @@ -2347,13 +1257,14 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> : public common_type<_Tp, _Tp> {}; +// bullet 3 - sizeof...(Tp) == 2 + // sub-bullet 1 - "If is_same_v<T1, D1> is false or ..." template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up> : conditional< _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, - // Fix for MSVC which thinks that std::common_type<int, void>::type == void. - __common_type2_imp<_Tp, _Up, typename conditional<is_void<_Tp>::value ^ is_void<_Up>::value, int, void>::type>, + __common_type2_imp<_Tp, _Up>, common_type<typename decay<_Tp>::type, typename decay<_Up>::type> >::type {}; @@ -2616,15 +1527,9 @@ struct __is_assignable_imp<_Tp, _Arg, true> { }; -#ifdef _LIBCPP_COMPILER_MSVC -template <class _Tp, class _Arg> -struct is_assignable - : public _VSTD::integral_constant<bool, __is_assignable(_Tp, _Arg)> {}; -#else template <class _Tp, class _Arg> struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; -#endif #if _LIBCPP_STD_VER > 14 template <class _Tp, class _Arg> @@ -2676,13 +1581,6 @@ inline constexpr bool is_destructible_v = __is_destructible(_Tp); // Otherwise, return "declval<_Up&>().~_Up()" is well-formed // where _Up is remove_all_extents<_Tp>::type -#if defined(_LIBCPP_COMPILER_MSVC) - -template <typename _Tp> -struct is_destructible : integral_constant<bool, __is_destructible(_Tp)> {}; - -#else - template <class> struct __is_destructible_apply { typedef int type; }; @@ -2732,8 +1630,6 @@ template <> struct is_destructible<void> : public false_type {}; -#endif - #if _LIBCPP_STD_VER > 14 template <class _Tp> inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; @@ -3439,10 +2335,6 @@ template <class _Tp> inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; #endif -template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; -template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; -template <class _Tp> struct __is_reference_wrapper - : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; #ifndef _LIBCPP_CXX03_LANG @@ -3595,16 +2487,10 @@ struct __invokable_r // or incomplete array types as required by the standard. using _Result = decltype(__try_call<_Fp, _Args...>(0)); - using type = - typename conditional< + using type = typename conditional< _IsNotSame<_Result, __nat>::value, - typename conditional< - is_void<_Ret>::value, - true_type, - is_convertible<_Result, _Ret> - >::type, - false_type - >::type; + 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> @@ -4100,8 +2986,4 @@ using __maybe_const = conditional_t<_Const, const _Tp, _Tp>; _LIBCPP_END_NAMESPACE_STD -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning(pop) -#endif - #endif // _LIBCPP_TYPE_TRAITS diff --git a/contrib/libs/cxxsupp/libcxx/include/typeindex b/contrib/libs/cxxsupp/libcxx/include/typeindex index 0b61f28b96..8da8f58c53 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeindex +++ b/contrib/libs/cxxsupp/libcxx/include/typeindex @@ -52,11 +52,6 @@ struct hash<type_index> #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/weak_result_type.h> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> #include <new> diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index e5741b0546..16b843b944 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -519,6 +519,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__config> #include <__debug> #include <__functional/is_transparent.h> +#include <__functional/operations.h> #include <__hash_table> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_set b/contrib/libs/cxxsupp/libcxx/include/unordered_set index de0e12197d..890475f36f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_set +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_set @@ -464,6 +464,7 @@ template <class Value, class Hash, class Pred, class Alloc> #include <__config> #include <__debug> #include <__functional/is_transparent.h> +#include <__functional/operations.h> #include <__hash_table> #include <__memory/addressof.h> #include <__node_handle> diff --git a/contrib/libs/cxxsupp/libcxx/include/variant b/contrib/libs/cxxsupp/libcxx/include/variant index 37cea87f25..eaff498586 100644 --- a/contrib/libs/cxxsupp/libcxx/include/variant +++ b/contrib/libs/cxxsupp/libcxx/include/variant @@ -221,10 +221,6 @@ namespace std { #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/reference_wrapper.h> -#include <__functional/weak_result_type.h> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> #include <typeinfo> diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 7e3fb0ee06..14146c86a0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -285,6 +285,7 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <__debug> #include <__format/enable_insertable.h> #include <__functional/hash.h> +#include <__functional/unary_function.h> #include <__iterator/iterator_traits.h> #include <__iterator/wrap_iter.h> #include <__memory/allocate_at_least.h> @@ -305,12 +306,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20 #include <version> // TODO: remove these headers -#include <__functional/binary_function.h> -#include <__functional/invoke.h> -#include <__functional/operations.h> -#include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> -#include <__functional/weak_result_type.h> #include <typeinfo> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -440,9 +435,14 @@ public: vector(initializer_list<value_type> __il, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY + vector& operator=(initializer_list<value_type> __il) + {assign(__il.begin(), __il.end()); return *this;} +#endif // !_LIBCPP_CXX03_LANG + + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT; + noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); #endif @@ -453,12 +453,6 @@ public: vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY - vector& operator=(initializer_list<value_type> __il) - {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG - template <class _InputIterator> typename enable_if < @@ -570,41 +564,26 @@ public: const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(this->__begin_);} -#ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(const value_type& __x) { push_back(__x); } -#else - template <class _Arg> - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(_Arg&& __arg) { - emplace_back(_VSTD::forward<_Arg>(__arg)); - } -#endif - _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); template <class... _Args> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 reference emplace_back(_Args&&... __args); #else void emplace_back(_Args&&... __args); #endif -#endif // !_LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x); -#ifndef _LIBCPP_CXX03_LANG iterator insert(const_iterator __position, value_type&& __x); template <class... _Args> - iterator emplace(const_iterator __position, _Args&&... __args); -#endif // !_LIBCPP_CXX03_LANG + iterator emplace(const_iterator __position, _Args&&... __args); iterator insert(const_iterator __position, size_type __n, const_reference __x); template <class _InputIterator> @@ -734,12 +713,6 @@ private: __annotate_shrink(__old_size); } -// Disable double inline warning. -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( push ) -#pragma warning ( disable : 4141 ) -#endif -#ifndef _LIBCPP_CXX03_LANG template <class _Up> _LIBCPP_INLINE_VISIBILITY inline void __push_back_slow_path(_Up&& __x); @@ -747,14 +720,6 @@ private: template <class... _Args> _LIBCPP_INLINE_VISIBILITY inline void __emplace_back_slow_path(_Args&&... __args); -#else - template <class _Up> - _LIBCPP_INLINE_VISIBILITY - inline void __push_back_slow_path(_Up& __x); -#endif -#ifdef _LIBCPP_COMPILER_MSVC -#pragma warning ( pop ) -#endif // The following functions are no-ops outside of AddressSanitizer mode. // We call annotatations only for the default Allocator because other allocators @@ -1145,7 +1110,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, { _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template <class _Tp, class _Allocator> @@ -1160,7 +1125,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c { _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template <class _Tp, class _Allocator> @@ -1225,13 +1190,11 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t<alloc } } -#ifndef _LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT + noexcept #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) #endif @@ -1266,6 +1229,8 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_ } } +#ifndef _LIBCPP_CXX03_LANG + template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) @@ -1291,6 +1256,8 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat } } +#endif // _LIBCPP_CXX03_LANG + template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1330,8 +1297,6 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) std::__debug_db_swap(this, std::addressof(__c)); } -#endif // !_LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1360,7 +1325,7 @@ vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) { clear(); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template <class _Tp, class _Allocator> @@ -1554,11 +1519,7 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT template <class _Tp, class _Allocator> template <class _Up> void -#ifndef _LIBCPP_CXX03_LANG vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) -#else -vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) -#endif { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); @@ -1581,8 +1542,6 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) __push_back_slow_path(__x); } -#ifndef _LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY void @@ -1630,8 +1589,6 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) #endif } -#endif // !_LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> inline void @@ -1688,9 +1645,9 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe _ConstructTransaction __tx(*this, __from_e - __i); for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void) ++__pos, __tx.__pos_ = __pos) { - __alloc_traits::construct(this->__alloc(), - _VSTD::__to_address(__pos), - _VSTD::move(*__i)); + __alloc_traits::construct(this->__alloc(), + _VSTD::__to_address(__pos), + _VSTD::move(*__i)); } } _VSTD::move_backward(__from_s, __from_s + __n, __old_last); @@ -1728,8 +1685,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) return __make_iter(__p); } -#ifndef _LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) @@ -1790,8 +1745,6 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) return __make_iter(__p); } -#endif // !_LIBCPP_CXX03_LANG - template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) @@ -2179,9 +2132,15 @@ public: vector(initializer_list<value_type> __il, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY + vector& operator=(initializer_list<value_type> __il) + {assign(__il.begin(), __il.end()); return *this;} + +#endif // !_LIBCPP_CXX03_LANG + + _LIBCPP_INLINE_VISIBILITY vector(vector&& __v) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT; + noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); #endif @@ -2190,12 +2149,6 @@ public: vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY - vector& operator=(initializer_list<value_type> __il) - {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG - template <class _InputIterator> typename enable_if < @@ -2792,8 +2745,6 @@ vector<bool, _Allocator>::operator=(const vector& __v) return *this; } -#ifndef _LIBCPP_CXX03_LANG - template <class _Allocator> inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>::vector(vector&& __v) #if _LIBCPP_STD_VER > 14 @@ -2865,8 +2816,6 @@ vector<bool, _Allocator>::__move_assign(vector& __c, true_type) __c.__cap() = __c.__size_ = 0; } -#endif // !_LIBCPP_CXX03_LANG - template <class _Allocator> void vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index bb8ec21d01..9e89375d62 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -117,7 +117,6 @@ __cpp_lib_map_try_emplace 201411L <map> __cpp_lib_math_constants 201907L <numbers> __cpp_lib_math_special_functions 201603L <cmath> __cpp_lib_memory_resource 201603L <memory_resource> -__cpp_lib_monadic_optional 202110L <optional> __cpp_lib_move_only_function 202110L <functional> __cpp_lib_node_extract 201606L <map> <set> <unordered_map> <unordered_set> @@ -127,7 +126,8 @@ __cpp_lib_nonmember_container_access 201411L <array> <deque> <unordered_map> <unordered_set> <vector> __cpp_lib_not_fn 201603L <functional> __cpp_lib_null_iterators 201304L <iterator> -__cpp_lib_optional 201606L <optional> +__cpp_lib_optional 202110L <optional> + 201606L // C++17 __cpp_lib_out_ptr 202106L <memory> __cpp_lib_parallel_algorithm 201603L <algorithm> <numeric> __cpp_lib_polymorphic_allocator 201902L <memory_resource> @@ -390,8 +390,9 @@ __cpp_lib_void_t 201411L <type_traits> // # define __cpp_lib_constexpr_typeinfo 202106L // # define __cpp_lib_invoke_r 202106L # define __cpp_lib_is_scoped_enum 202011L -# define __cpp_lib_monadic_optional 202110L // # define __cpp_lib_move_only_function 202110L +# undef __cpp_lib_optional +# define __cpp_lib_optional 202110L // # define __cpp_lib_out_ptr 202106L // # define __cpp_lib_ranges_chunk 202202L // # define __cpp_lib_ranges_chunk_by 202202L diff --git a/contrib/libs/cxxsupp/libcxx/src/barrier.cpp b/contrib/libs/cxxsupp/libcxx/src/barrier.cpp index 54890b2d79..8ce2c043cf 100644 --- a/contrib/libs/cxxsupp/libcxx/src/barrier.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/barrier.cpp @@ -90,7 +90,7 @@ void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) delete __barrier; } -#endif //!defined(_LIBCPP_HAS_NO_TREE_BARRIER) +#endif // !defined(_LIBCPP_HAS_NO_TREE_BARRIER) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/include/config_elast.h b/contrib/libs/cxxsupp/libcxx/src/include/config_elast.h index 0ed53a3b20..bef26ec501 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/config_elast.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/config_elast.h @@ -29,6 +29,8 @@ // No _LIBCPP_ELAST needed on Fuchsia #elif defined(__wasi__) // No _LIBCPP_ELAST needed on WASI +#elif defined(__EMSCRIPTEN__) +// No _LIBCPP_ELAST needed on Emscripten #elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_ELAST 4095 #elif defined(__APPLE__) diff --git a/contrib/libs/cxxsupp/libcxx/src/memory.cpp b/contrib/libs/cxxsupp/libcxx/src/memory.cpp index 55fc4afe58..e207e05e15 100644 --- a/contrib/libs/cxxsupp/libcxx/src/memory.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/memory.cpp @@ -95,7 +95,6 @@ __shared_weak_count::__release_shared() noexcept if (__shared_count::__release_shared()) __release_weak(); } - #endif // _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS void diff --git a/contrib/libs/cxxsupp/libcxx/src/string.cpp b/contrib/libs/cxxsupp/libcxx/src/string.cpp index 9d1de0cf6c..8db129520e 100644 --- a/contrib/libs/cxxsupp/libcxx/src/string.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/string.cpp @@ -56,42 +56,33 @@ void __basic_string_common<true>::__throw_out_of_range() const { #endif #undef _LIBCPP_EXTERN_TEMPLATE_DEFINE -template string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&); +template string operator+<char, char_traits<char>, allocator<char>>(char const*, string const&); namespace { template<typename T> -inline -void throw_helper( const string& msg ) -{ +inline void throw_helper(const string& msg) { #ifndef _LIBCPP_NO_EXCEPTIONS - throw T( msg ); + throw T(msg); #else fprintf(stderr, "%s\n", msg.c_str()); _VSTD::abort(); #endif } -inline -void throw_from_string_out_of_range( const string& func ) -{ +inline void throw_from_string_out_of_range(const string& func) { throw_helper<out_of_range>(func + ": out of range"); } -inline -void throw_from_string_invalid_arg( const string& func ) -{ +inline void throw_from_string_invalid_arg(const string& func) { throw_helper<invalid_argument>(func + ": no conversion"); } // as_integer template<typename V, typename S, typename F> -inline -V -as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f) -{ +inline V as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f) { typename S::value_type* ptr = nullptr; const typename S::value_type* const p = str.c_str(); typename remove_reference<decltype(errno)>::type errno_save = errno; @@ -108,109 +99,77 @@ as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f) } template<typename V, typename S> -inline -V -as_integer(const string& func, const S& s, size_t* idx, int base); +inline V as_integer(const string& func, const S& s, size_t* idx, int base); // string template<> -inline -int -as_integer(const string& func, const string& s, size_t* idx, int base ) -{ +inline int as_integer(const string& func, const string& s, size_t* idx, int base) { // Use long as no Standard string to integer exists. - long r = as_integer_helper<long>( func, s, idx, base, strtol ); + long r = as_integer_helper<long>(func, s, idx, base, strtol); if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r) throw_from_string_out_of_range(func); return static_cast<int>(r); } template<> -inline -long -as_integer(const string& func, const string& s, size_t* idx, int base ) -{ - return as_integer_helper<long>( func, s, idx, base, strtol ); +inline long as_integer(const string& func, const string& s, size_t* idx, int base) { + return as_integer_helper<long>(func, s, idx, base, strtol); } template<> -inline -unsigned long -as_integer( const string& func, const string& s, size_t* idx, int base ) -{ - return as_integer_helper<unsigned long>( func, s, idx, base, strtoul ); +inline unsigned long as_integer(const string& func, const string& s, size_t* idx, int base) { + return as_integer_helper<unsigned long>(func, s, idx, base, strtoul); } template<> -inline -long long -as_integer( const string& func, const string& s, size_t* idx, int base ) -{ - return as_integer_helper<long long>( func, s, idx, base, strtoll ); +inline long long as_integer(const string& func, const string& s, size_t* idx, int base) { + return as_integer_helper<long long>(func, s, idx, base, strtoll); } template<> -inline -unsigned long long -as_integer( const string& func, const string& s, size_t* idx, int base ) -{ - return as_integer_helper<unsigned long long>( func, s, idx, base, strtoull ); +inline unsigned long long as_integer(const string& func, const string& s, size_t* idx, int base) { + return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS // wstring template<> -inline -int -as_integer( const string& func, const wstring& s, size_t* idx, int base ) -{ +inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) { // Use long as no Stantard string to integer exists. - long r = as_integer_helper<long>( func, s, idx, base, wcstol ); + long r = as_integer_helper<long>(func, s, idx, base, wcstol); if (r < numeric_limits<int>::min() || numeric_limits<int>::max() < r) throw_from_string_out_of_range(func); return static_cast<int>(r); } template<> -inline -long -as_integer( const string& func, const wstring& s, size_t* idx, int base ) -{ - return as_integer_helper<long>( func, s, idx, base, wcstol ); +inline long as_integer(const string& func, const wstring& s, size_t* idx, int base) { + return as_integer_helper<long>(func, s, idx, base, wcstol); } template<> inline unsigned long -as_integer( const string& func, const wstring& s, size_t* idx, int base ) +as_integer(const string& func, const wstring& s, size_t* idx, int base) { - return as_integer_helper<unsigned long>( func, s, idx, base, wcstoul ); + return as_integer_helper<unsigned long>(func, s, idx, base, wcstoul); } template<> -inline -long long -as_integer( const string& func, const wstring& s, size_t* idx, int base ) -{ - return as_integer_helper<long long>( func, s, idx, base, wcstoll ); +inline long long as_integer(const string& func, const wstring& s, size_t* idx, int base) { + return as_integer_helper<long long>(func, s, idx, base, wcstoll); } template<> -inline -unsigned long long -as_integer( const string& func, const wstring& s, size_t* idx, int base ) -{ - return as_integer_helper<unsigned long long>( func, s, idx, base, wcstoull ); +inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) { + return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull); } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS // as_float template<typename V, typename S, typename F> -inline -V -as_float_helper(const string& func, const S& str, size_t* idx, F f ) -{ +inline V as_float_helper(const string& func, const S& str, size_t* idx, F f) { typename S::value_type* ptr = nullptr; const typename S::value_type* const p = str.c_str(); typename remove_reference<decltype(errno)>::type errno_save = errno; @@ -227,172 +186,107 @@ as_float_helper(const string& func, const S& str, size_t* idx, F f ) } template<typename V, typename S> -inline -V as_float( const string& func, const S& s, size_t* idx = nullptr ); +inline V as_float(const string& func, const S& s, size_t* idx = nullptr); template<> -inline -float -as_float( const string& func, const string& s, size_t* idx ) -{ - return as_float_helper<float>( func, s, idx, strtof ); +inline float as_float(const string& func, const string& s, size_t* idx) { + return as_float_helper<float>(func, s, idx, strtof); } template<> -inline -double -as_float(const string& func, const string& s, size_t* idx ) -{ - return as_float_helper<double>( func, s, idx, strtod ); +inline double as_float(const string& func, const string& s, size_t* idx) { + return as_float_helper<double>(func, s, idx, strtod); } template<> -inline -long double -as_float( const string& func, const string& s, size_t* idx ) -{ - return as_float_helper<long double>( func, s, idx, strtold ); +inline long double as_float(const string& func, const string& s, size_t* idx) { + return as_float_helper<long double>(func, s, idx, strtold); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template<> -inline -float -as_float( const string& func, const wstring& s, size_t* idx ) -{ - return as_float_helper<float>( func, s, idx, wcstof ); +inline float as_float(const string& func, const wstring& s, size_t* idx) { + return as_float_helper<float>(func, s, idx, wcstof); } template<> -inline -double -as_float( const string& func, const wstring& s, size_t* idx ) -{ - return as_float_helper<double>( func, s, idx, wcstod ); +inline double as_float(const string& func, const wstring& s, size_t* idx) { + return as_float_helper<double>(func, s, idx, wcstod); } template<> -inline -long double -as_float( const string& func, const wstring& s, size_t* idx ) -{ - return as_float_helper<long double>( func, s, idx, wcstold ); +inline long double as_float(const string& func, const wstring& s, size_t* idx) { + return as_float_helper<long double>(func, s, idx, wcstold); } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS } // unnamed namespace -int -stoi(const string& str, size_t* idx, int base) -{ - return as_integer<int>( "stoi", str, idx, base ); +int stoi(const string& str, size_t* idx, int base) { + return as_integer<int>("stoi", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -int -stoi(const wstring& str, size_t* idx, int base) -{ - return as_integer<int>( "stoi", str, idx, base ); +long stol(const string& str, size_t* idx, int base) { + return as_integer<long>("stol", str, idx, base); } -#endif -long -stol(const string& str, size_t* idx, int base) -{ - return as_integer<long>( "stol", str, idx, base ); +unsigned long stoul(const string& str, size_t* idx, int base) { + return as_integer<unsigned long>("stoul", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -long -stol(const wstring& str, size_t* idx, int base) -{ - return as_integer<long>( "stol", str, idx, base ); +long long stoll(const string& str, size_t* idx, int base) { + return as_integer<long long>("stoll", str, idx, base); } -#endif -unsigned long -stoul(const string& str, size_t* idx, int base) -{ - return as_integer<unsigned long>( "stoul", str, idx, base ); +unsigned long long stoull(const string& str, size_t* idx, int base) { + return as_integer<unsigned long long>("stoull", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -unsigned long -stoul(const wstring& str, size_t* idx, int base) -{ - return as_integer<unsigned long>( "stoul", str, idx, base ); +float stof(const string& str, size_t* idx) { + return as_float<float>("stof", str, idx); } -#endif -long long -stoll(const string& str, size_t* idx, int base) -{ - return as_integer<long long>( "stoll", str, idx, base ); +double stod(const string& str, size_t* idx) { + return as_float<double>("stod", str, idx); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -long long -stoll(const wstring& str, size_t* idx, int base) -{ - return as_integer<long long>( "stoll", str, idx, base ); +long double stold(const string& str, size_t* idx) { + return as_float<long double>("stold", str, idx); } -#endif -unsigned long long -stoull(const string& str, size_t* idx, int base) -{ - return as_integer<unsigned long long>( "stoull", str, idx, base ); +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +int stoi(const wstring& str, size_t* idx, int base) { + return as_integer<int>("stoi", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -unsigned long long -stoull(const wstring& str, size_t* idx, int base) -{ - return as_integer<unsigned long long>( "stoull", str, idx, base ); +long stol(const wstring& str, size_t* idx, int base) { + return as_integer<long>("stol", str, idx, base); } -#endif -float -stof(const string& str, size_t* idx) -{ - return as_float<float>( "stof", str, idx ); +unsigned long stoul(const wstring& str, size_t* idx, int base) { + return as_integer<unsigned long>("stoul", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -float -stof(const wstring& str, size_t* idx) -{ - return as_float<float>( "stof", str, idx ); +long long stoll(const wstring& str, size_t* idx, int base) { + return as_integer<long long>("stoll", str, idx, base); } -#endif -double -stod(const string& str, size_t* idx) -{ - return as_float<double>( "stod", str, idx ); +unsigned long long stoull(const wstring& str, size_t* idx, int base) { + return as_integer<unsigned long long>("stoull", str, idx, base); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -double -stod(const wstring& str, size_t* idx) -{ - return as_float<double>( "stod", str, idx ); +float stof(const wstring& str, size_t* idx) { + return as_float<float>("stof", str, idx); } -#endif -long double -stold(const string& str, size_t* idx) -{ - return as_float<long double>( "stold", str, idx ); +double stod(const wstring& str, size_t* idx) { + return as_float<double>("stod", str, idx); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -long double -stold(const wstring& str, size_t* idx) -{ - return as_float<long double>( "stold", str, idx ); +long double stold(const wstring& str, size_t* idx) { + return as_float<long double>("stold", str, idx); } -#endif +#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS // to_string @@ -402,21 +296,15 @@ namespace // as_string template<typename S, typename P, typename V > -inline -S -as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a) -{ +inline S as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a) { typedef typename S::size_type size_type; size_type available = s.size(); - while (true) - { + while (true) { int status = sprintf_like(&s[0], available + 1, fmt, a); - if ( status >= 0 ) - { + if (status >= 0) { size_type used = static_cast<size_type>(status); - if ( used <= available ) - { - s.resize( used ); + if (used <= available) { + s.resize(used); break; } available = used; // Assume this is advice of how much space we need. @@ -432,11 +320,8 @@ template <class S> struct initial_string; template <> -struct initial_string<string> -{ - string - operator()() const - { +struct initial_string<string> { + string operator()() const { string s; s.resize(s.capacity()); return s; @@ -445,11 +330,8 @@ struct initial_string<string> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> -struct initial_string<wstring> -{ - wstring - operator()() const - { +struct initial_string<wstring> { + wstring operator()() const { wstring s(20, wchar_t()); s.resize(s.capacity()); return s; @@ -458,10 +340,7 @@ struct initial_string<wstring> typedef int (*wide_printf)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...); -inline -wide_printf -get_swprintf() -{ +inline wide_printf get_swprintf() { #ifndef _LIBCPP_MSVCRT return swprintf; #else @@ -471,8 +350,7 @@ get_swprintf() #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template <typename S, typename V> -S i_to_string(V v) -{ +S i_to_string(V v) { // numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers. // For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented), // so we need +1 here. diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index a672848b92..04eedb0400 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -13,9 +13,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(2022-05-18) +VERSION(2022-06-01) -ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/4d8268fbf4cd30d39530622b7f1dc487122b4f3c.tar.gz) +ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/10c4eec2785a68880c287d36c262d5be3a72a128.tar.gz) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include |