diff options
author | AlexSm <alex@ydb.tech> | 2024-03-05 10:40:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 12:40:59 +0300 |
commit | 1ac13c847b5358faba44dbb638a828e24369467b (patch) | |
tree | 07672b4dd3604ad3dee540a02c6494cb7d10dc3d /contrib/libs/cxxsupp/libcxx/include/__functional | |
parent | ffcca3e7f7958ddc6487b91d3df8c01054bd0638 (diff) | |
download | ydb-1ac13c847b5358faba44dbb638a828e24369467b.tar.gz |
Library import 16 (#2433)
Co-authored-by: robot-piglet <robot-piglet@yandex-team.com>
Co-authored-by: deshevoy <deshevoy@yandex-team.com>
Co-authored-by: robot-contrib <robot-contrib@yandex-team.com>
Co-authored-by: thegeorg <thegeorg@yandex-team.com>
Co-authored-by: robot-ya-builder <robot-ya-builder@yandex-team.com>
Co-authored-by: svidyuk <svidyuk@yandex-team.com>
Co-authored-by: shadchin <shadchin@yandex-team.com>
Co-authored-by: robot-ratatosk <robot-ratatosk@yandex-team.com>
Co-authored-by: innokentii <innokentii@yandex-team.com>
Co-authored-by: arkady-e1ppa <arkady-e1ppa@yandex-team.com>
Co-authored-by: snermolaev <snermolaev@yandex-team.com>
Co-authored-by: dimdim11 <dimdim11@yandex-team.com>
Co-authored-by: kickbutt <kickbutt@yandex-team.com>
Co-authored-by: abdullinsaid <abdullinsaid@yandex-team.com>
Co-authored-by: korsunandrei <korsunandrei@yandex-team.com>
Co-authored-by: petrk <petrk@yandex-team.com>
Co-authored-by: miroslav2 <miroslav2@yandex-team.com>
Co-authored-by: serjflint <serjflint@yandex-team.com>
Co-authored-by: akhropov <akhropov@yandex-team.com>
Co-authored-by: prettyboy <prettyboy@yandex-team.com>
Co-authored-by: ilikepugs <ilikepugs@yandex-team.com>
Co-authored-by: hiddenpath <hiddenpath@yandex-team.com>
Co-authored-by: mikhnenko <mikhnenko@yandex-team.com>
Co-authored-by: spreis <spreis@yandex-team.com>
Co-authored-by: andreyshspb <andreyshspb@yandex-team.com>
Co-authored-by: dimaandreev <dimaandreev@yandex-team.com>
Co-authored-by: rashid <rashid@yandex-team.com>
Co-authored-by: robot-ydb-importer <robot-ydb-importer@yandex-team.com>
Co-authored-by: r-vetrov <r-vetrov@yandex-team.com>
Co-authored-by: ypodlesov <ypodlesov@yandex-team.com>
Co-authored-by: zaverden <zaverden@yandex-team.com>
Co-authored-by: vpozdyayev <vpozdyayev@yandex-team.com>
Co-authored-by: robot-cozmo <robot-cozmo@yandex-team.com>
Co-authored-by: v-korovin <v-korovin@yandex-team.com>
Co-authored-by: arikon <arikon@yandex-team.com>
Co-authored-by: khoden <khoden@yandex-team.com>
Co-authored-by: psydmm <psydmm@yandex-team.com>
Co-authored-by: robot-javacom <robot-javacom@yandex-team.com>
Co-authored-by: dtorilov <dtorilov@yandex-team.com>
Co-authored-by: sennikovmv <sennikovmv@yandex-team.com>
Co-authored-by: hcpp <hcpp@ydb.tech>
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__functional')
20 files changed, 422 insertions, 906 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h index 3d50ffa439..69b13df8ab 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h @@ -13,9 +13,11 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/weak_result_type.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_reference_wrapper.h> +#include <__type_traits/is_void.h> #include <cstddef> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -30,9 +32,9 @@ struct is_bind_expression : _If< is_bind_expression<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value; +inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value; #endif template<class _Tp> @@ -42,9 +44,9 @@ struct is_placeholder : _If< is_placeholder<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value; +inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value; #endif namespace placeholders @@ -52,29 +54,24 @@ namespace placeholders template <int _Np> struct __ph {}; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) -_LIBCPP_FUNC_VIS extern const __ph<1> _1; -_LIBCPP_FUNC_VIS extern const __ph<2> _2; -_LIBCPP_FUNC_VIS extern const __ph<3> _3; -_LIBCPP_FUNC_VIS extern const __ph<4> _4; -_LIBCPP_FUNC_VIS extern const __ph<5> _5; -_LIBCPP_FUNC_VIS extern const __ph<6> _6; -_LIBCPP_FUNC_VIS extern const __ph<7> _7; -_LIBCPP_FUNC_VIS extern const __ph<8> _8; -_LIBCPP_FUNC_VIS extern const __ph<9> _9; -_LIBCPP_FUNC_VIS extern const __ph<10> _10; -#else -/* inline */ constexpr __ph<1> _1{}; -/* inline */ constexpr __ph<2> _2{}; -/* inline */ constexpr __ph<3> _3{}; -/* inline */ constexpr __ph<4> _4{}; -/* inline */ constexpr __ph<5> _5{}; -/* inline */ constexpr __ph<6> _6{}; -/* inline */ constexpr __ph<7> _7{}; -/* inline */ constexpr __ph<8> _8{}; -/* inline */ constexpr __ph<9> _9{}; -/* inline */ constexpr __ph<10> _10{}; -#endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) +// C++17 recommends that we implement placeholders as `inline constexpr`, but allows +// implementing them as `extern <implementation-defined>`. Libc++ implements them as +// `extern const` in all standard modes to avoid an ABI break in C++03: making them +// `inline constexpr` requires removing their definition in the shared library to +// avoid ODR violations, which is an ABI break. +// +// In practice, since placeholders are empty, `extern const` is almost impossible +// to distinguish from `inline constexpr` from a usage stand point. +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9; +_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10; } // namespace placeholders @@ -86,7 +83,7 @@ struct is_placeholder<placeholders::__ph<_Np> > #ifndef _LIBCPP_CXX03_LANG template <class _Tp, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) { @@ -94,7 +91,7 @@ __mu(reference_wrapper<_Tp> __t, _Uj&) } template <class _Ti, class ..._Uj, size_t ..._Indx> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) { @@ -102,7 +99,7 @@ __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) } template <class _Ti, class ..._Uj> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __enable_if_t < is_bind_expression<_Ti>::value, @@ -124,7 +121,7 @@ struct __mu_return2<true, _Ti, _Uj> }; template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if < 0 < is_placeholder<_Ti>::value, @@ -132,12 +129,12 @@ typename enable_if >::type __mu(_Ti&, _Uj& __uj) { - const size_t _Indx = is_placeholder<_Ti>::value - 1; - return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj)); + const size_t __indx = is_placeholder<_Ti>::value - 1; + return _VSTD::forward<typename tuple_element<__indx, _Uj>::type>(_VSTD::get<__indx>(__uj)); } template <class _Ti, class _Uj> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if < !is_bind_expression<_Ti>::value && @@ -255,7 +252,7 @@ struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> }; template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) @@ -264,11 +261,11 @@ __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, } template<class _Fp, class ..._BoundArgs> -class __bind : public __weak_result_type<typename decay<_Fp>::type> +class __bind : public __weak_result_type<__decay_t<_Fp> > { protected: - typedef typename decay<_Fp>::type _Fd; - typedef tuple<typename decay<_BoundArgs>::type...> _Td; + using _Fd = __decay_t<_Fp>; + typedef tuple<__decay_t<_BoundArgs>...> _Td; private: _Fd __f_; _Td __bound_args_; diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h index f0a6e49875..71dc63c86b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_back.h @@ -13,10 +13,10 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/perfect_forward.h> +#include <__type_traits/decay.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <size_t _NBound, class = make_index_sequence<_NBound>> struct __bind_back_op; @@ -57,7 +57,7 @@ constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) -> decltype( __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...))) { return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_front.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_front.h index 22fb3a69dc..72bb664809 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind_front.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind_front.h @@ -13,8 +13,12 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/perfect_forward.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_move_constructible.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct __bind_front_op { template <class ..._Args> @@ -51,7 +55,7 @@ constexpr auto bind_front(_Fn&& __f, _Args&&... __args) { return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/binder1st.h b/contrib/libs/cxxsupp/libcxx/include/__functional/binder1st.h index dea22c70e1..78049d13f9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/binder1st.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/binder1st.h @@ -21,30 +21,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) -template <class __Operation> +template <class _Operation> class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st - : public __unary_function<typename __Operation::second_argument_type, typename __Operation::result_type> + : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> { protected: - __Operation op; - typename __Operation::first_argument_type value; + _Operation op; + typename _Operation::first_argument_type value; public: - _LIBCPP_INLINE_VISIBILITY binder1st(const __Operation& __x, - const typename __Operation::first_argument_type __y) + _LIBCPP_INLINE_VISIBILITY binder1st(const _Operation& __x, + const typename _Operation::first_argument_type __y) : op(__x), value(__y) {} - _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator() - (typename __Operation::second_argument_type& __x) const + _LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator() + (typename _Operation::second_argument_type& __x) const {return op(value, __x);} - _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator() - (const typename __Operation::second_argument_type& __x) const + _LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator() + (const typename _Operation::second_argument_type& __x) const {return op(value, __x);} }; -template <class __Operation, class _Tp> +template <class _Operation, class _Tp> _LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY -binder1st<__Operation> -bind1st(const __Operation& __op, const _Tp& __x) - {return binder1st<__Operation>(__op, __x);} +binder1st<_Operation> +bind1st(const _Operation& __op, const _Tp& __x) + {return binder1st<_Operation>(__op, __x);} #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/binder2nd.h b/contrib/libs/cxxsupp/libcxx/include/__functional/binder2nd.h index c98a146b6a..a3227745bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/binder2nd.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/binder2nd.h @@ -21,30 +21,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) -template <class __Operation> +template <class _Operation> class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd - : public __unary_function<typename __Operation::first_argument_type, typename __Operation::result_type> + : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> { protected: - __Operation op; - typename __Operation::second_argument_type value; + _Operation op; + typename _Operation::second_argument_type value; public: _LIBCPP_INLINE_VISIBILITY - binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y) + binder2nd(const _Operation& __x, const typename _Operation::second_argument_type __y) : op(__x), value(__y) {} - _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator() - ( typename __Operation::first_argument_type& __x) const + _LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator() + ( typename _Operation::first_argument_type& __x) const {return op(__x, value);} - _LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator() - (const typename __Operation::first_argument_type& __x) const + _LIBCPP_INLINE_VISIBILITY typename _Operation::result_type operator() + (const typename _Operation::first_argument_type& __x) const {return op(__x, value);} }; -template <class __Operation, class _Tp> +template <class _Operation, class _Tp> _LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY -binder2nd<__Operation> -bind2nd(const __Operation& __op, const _Tp& __x) - {return binder2nd<__Operation>(__op, __x);} +binder2nd<_Operation> +bind2nd(const _Operation& __op, const _Tp& __x) + {return binder2nd<_Operation>(__op, __x);} #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h b/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h index a6750893ee..0165e06281 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/boyer_moore_searcher.h @@ -20,12 +20,13 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__memory/shared_ptr.h> +#include <__type_traits/make_unsigned.h> #include <__utility/pair.h> #include <array> #include <unordered_map> #include <vector> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -113,6 +114,7 @@ private: && is_same_v<_BinaryPredicate, equal_to<>>>; public: + _LIBCPP_HIDE_FROM_ABI boyer_moore_searcher(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _Hash __hash = _Hash(), @@ -134,7 +136,7 @@ public: } template <class _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> + _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2> operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const { static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type, typename iterator_traits<_RandomAccessIterator2>::value_type>::value, @@ -158,7 +160,7 @@ private: shared_ptr<difference_type[]> __suffix_; template <class _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> + _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2> __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { _RandomAccessIterator2 __current = __f; const _RandomAccessIterator2 __last = __l - __pattern_length_; @@ -183,7 +185,8 @@ private: } template <class _Iterator, class _Container> - void __compute_bm_prefix(_Iterator __first, _Iterator __last, _BinaryPredicate __pred, _Container& __prefix) { + _LIBCPP_HIDE_FROM_ABI void + __compute_bm_prefix(_Iterator __first, _Iterator __last, _BinaryPredicate __pred, _Container& __prefix) { const size_t __count = __last - __first; __prefix[0] = 0; @@ -199,7 +202,8 @@ private: } } - void __build_suffix_table(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _BinaryPredicate __pred) { + _LIBCPP_HIDE_FROM_ABI void + __build_suffix_table(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _BinaryPredicate __pred) { const size_t __count = __last - __first; if (__count == 0) @@ -241,6 +245,7 @@ private: && is_same_v<_Hash, hash<value_type>> && is_same_v<_BinaryPredicate, equal_to<>>>; public: + _LIBCPP_HIDE_FROM_ABI boyer_moore_horspool_searcher(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _Hash __hash = _Hash(), @@ -262,7 +267,7 @@ public: } template <class _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> + _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2> operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const { static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type, typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, @@ -286,7 +291,7 @@ private: shared_ptr<__skip_table_type> __skip_table_; template <class _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> + _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2> __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const { _RandomAccessIterator2 __current = __f; const _RandomAccessIterator2 __last = __l - __pattern_length_; @@ -310,6 +315,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/compose.h b/contrib/libs/cxxsupp/libcxx/include/__functional/compose.h index 25213f28b1..80fcd7076c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/compose.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/compose.h @@ -13,8 +13,8 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/perfect_forward.h> +#include <__type_traits/decay.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct __compose_op { template<class _Fn1, class _Fn2, class ..._Args> @@ -45,7 +45,7 @@ constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) -> decltype( __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2))) { return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2)); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h b/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h index e4151e589f..222b4c66e6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/default_searcher.h @@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // default searcher template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> @@ -50,7 +50,7 @@ private: }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher); -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index 9f92f61814..3c6e3f450d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -12,6 +12,7 @@ #include <__assert> #include <__config> +#include <__exception/exception.h> #include <__functional/binary_function.h> #include <__functional/invoke.h> #include <__functional/unary_function.h> @@ -23,15 +24,21 @@ #include <__memory/builtin_new_allocator.h> #include <__memory/compressed_pair.h> #include <__memory/unique_ptr.h> +#include <__type_traits/aligned_storage.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_core_convertible.h> +#include <__type_traits/is_scalar.h> +#include <__type_traits/is_trivially_copy_constructible.h> +#include <__type_traits/is_trivially_destructible.h> +#include <__type_traits/is_void.h> #include <__type_traits/strip_signature.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/piecewise_construct.h> #include <__utility/swap.h> -#include <exception> +#include <__verbose_abort> #include <new> #include <tuple> -#include <type_traits> #include <typeinfo> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -46,7 +53,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") -class _LIBCPP_EXCEPTION_ABI bad_function_call +class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception { public: @@ -56,7 +63,7 @@ public: #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION ~bad_function_call() _NOEXCEPT override; #else - ~bad_function_call() _NOEXCEPT override {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {} #endif #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE @@ -68,10 +75,10 @@ _LIBCPP_DIAGNOSTIC_POP _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_function_call() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_function_call(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode"); #endif } @@ -201,7 +208,7 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> _LIBCPP_INLINE_VISIBILITY void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); } - static void __destroy_and_delete(__alloc_func* __f) { + _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) { typedef allocator_traits<_Alloc> __alloc_traits; typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc; _FunAlloc __a(__f->__get_allocator()); @@ -245,7 +252,7 @@ public: _LIBCPP_INLINE_VISIBILITY void destroy() _NOEXCEPT { __f_.~_Target(); } - static void __destroy_and_delete(__default_alloc_func* __f) { + _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__default_alloc_func* __f) { __f->destroy(); __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1); } @@ -300,14 +307,14 @@ public: explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} - virtual __base<_Rp(_ArgTypes...)>* __clone() const; - virtual void __clone(__base<_Rp(_ArgTypes...)>*) const; - virtual void destroy() _NOEXCEPT; - virtual void destroy_deallocate() _NOEXCEPT; - virtual _Rp operator()(_ArgTypes&&... __arg); + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg); #ifndef _LIBCPP_HAS_NO_RTTI - virtual const void* target(const type_info&) const _NOEXCEPT; - virtual const std::type_info& target_type() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT; #endif // _LIBCPP_HAS_NO_RTTI }; @@ -389,7 +396,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> typedef __base<_Rp(_ArgTypes...)> __func; __func* __f_; - _LIBCPP_NO_CFI static __func* __as_base(void* __p) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p) { return reinterpret_cast<__func*>(__p); } @@ -427,7 +434,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> } template <class _Fp, - class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type> + class = typename enable_if<!is_same<__decay_t<_Fp>, __value_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f) : __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {} @@ -614,33 +621,34 @@ struct __policy _LIBCPP_INLINE_VISIBILITY static const __policy* __create_empty() { - static const _LIBCPP_CONSTEXPR __policy __policy_ = {nullptr, nullptr, - true, + static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr, + true, #ifndef _LIBCPP_HAS_NO_RTTI - &typeid(void) + &typeid(void) #else - nullptr + nullptr #endif }; - return &__policy_; + return &__policy; } private: - template <typename _Fun> static void* __large_clone(const void* __s) + template <typename _Fun> + _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s) { const _Fun* __f = static_cast<const _Fun*>(__s); return __f->__clone(); } template <typename _Fun> - static void __large_destroy(void* __s) { + _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) { _Fun::__destroy_and_delete(static_cast<_Fun*>(__s)); } template <typename _Fun> _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ false_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { &__large_clone<_Fun>, &__large_destroy<_Fun>, false, #ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) @@ -648,14 +656,14 @@ struct __policy nullptr #endif }; - return &__policy_; + return &__policy; } template <typename _Fun> _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ true_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { nullptr, nullptr, false, #ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) @@ -663,7 +671,7 @@ struct __policy nullptr #endif }; - return &__policy_; + return &__policy; } }; @@ -699,14 +707,14 @@ struct __policy_invoker<_Rp(_ArgTypes...)> _LIBCPP_INLINE_VISIBILITY explicit __policy_invoker(__Call __c) : __call_(__c) {} - static _Rp __call_empty(const __policy_storage*, + _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) { __throw_bad_function_call(); } template <typename _Fun> - static _Rp __call_impl(const __policy_storage* __buf, + _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf, __fast_forward<_ArgTypes>... __args) { _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value @@ -770,7 +778,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)> } } - template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type> + template <class _Fp, class = typename enable_if<!is_same<__decay_t<_Fp>, __policy_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) { typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun; @@ -915,7 +923,7 @@ public: { } virtual __base<_Rp(_ArgTypes...)>* __clone() const { - _LIBCPP_ASSERT(false, + _LIBCPP_ASSERT_INTERNAL(false, "Block pointers are just pointers, so they should always fit into " "std::function's small buffer optimization. This function should " "never be invoked."); @@ -935,7 +943,7 @@ public: } virtual void destroy_deallocate() _NOEXCEPT { - _LIBCPP_ASSERT(false, + _LIBCPP_ASSERT_INTERNAL(false, "Block pointers are just pointers, so they should always fit into " "std::function's small buffer optimization. This function should " "never be invoked."); @@ -1002,11 +1010,11 @@ public: _LIBCPP_INLINE_VISIBILITY function() _NOEXCEPT { } _LIBCPP_INLINE_VISIBILITY - function(nullptr_t) _NOEXCEPT {} - function(const function&); - function(function&&) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {} + _LIBCPP_HIDE_FROM_ABI function(const function&); + _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT; template<class _Fp, class = _EnableIfLValueCallable<_Fp>> - function(_Fp); + _LIBCPP_HIDE_FROM_ABI function(_Fp); #if _LIBCPP_STD_VER <= 14 template<class _Alloc> @@ -1016,23 +1024,23 @@ public: _LIBCPP_INLINE_VISIBILITY function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {} template<class _Alloc> - function(allocator_arg_t, const _Alloc&, const function&); + _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&); template<class _Alloc> - function(allocator_arg_t, const _Alloc&, function&&); + _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&); template<class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>> - function(allocator_arg_t, const _Alloc& __a, _Fp __f); + _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f); #endif - function& operator=(const function&); - function& operator=(function&&) _NOEXCEPT; - function& operator=(nullptr_t) _NOEXCEPT; - template<class _Fp, class = _EnableIfLValueCallable<typename decay<_Fp>::type>> - function& operator=(_Fp&&); + _LIBCPP_HIDE_FROM_ABI function& operator=(const function&); + _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT; + template<class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>> + _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&); - ~function(); + _LIBCPP_HIDE_FROM_ABI ~function(); // function modifiers: - void swap(function&) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT; #if _LIBCPP_STD_VER <= 14 template<class _Fp, class _Alloc> @@ -1050,17 +1058,21 @@ public: // deleted overloads close possible hole in the type system template<class _R2, class... _ArgTypes2> bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete; +#if _LIBCPP_STD_VER <= 17 template<class _R2, class... _ArgTypes2> bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete; +#endif public: // function invocation: - _Rp operator()(_ArgTypes...) const; + _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const; #ifndef _LIBCPP_HAS_NO_RTTI // function target access: - const std::type_info& target_type() const _NOEXCEPT; - template <typename _Tp> _Tp* target() _NOEXCEPT; - template <typename _Tp> const _Tp* target() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT; + template <typename _Tp> + _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT; + template <typename _Tp> + _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT; #endif // _LIBCPP_HAS_NO_RTTI }; @@ -1188,6 +1200,8 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;} +#if _LIBCPP_STD_VER <= 17 + template <class _Rp, class... _ArgTypes> inline _LIBCPP_INLINE_VISIBILITY bool @@ -1203,6 +1217,8 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;} +#endif // _LIBCPP_STD_VER <= 17 + template <class _Rp, class... _ArgTypes> inline _LIBCPP_INLINE_VISIBILITY void diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h index 39382aa9bf..fa09748b14 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/hash.h @@ -13,7 +13,7 @@ #include <__functional/invoke.h> #include <__functional/unary_function.h> #include <__fwd/hash.h> -#include <__tuple_dir/sfinae_helpers.h> +#include <__tuple/sfinae_helpers.h> #include <__type_traits/is_copy_constructible.h> #include <__type_traits/is_default_constructible.h> #include <__type_traits/is_enum.h> @@ -35,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) { @@ -53,73 +53,113 @@ struct __murmur2_or_cityhash; template <class _Size> struct __murmur2_or_cityhash<_Size, 32> { - inline _Size operator()(const void* __key, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + _Size operator()(const void* __key, _Size __len) const { + // murmur2 + const _Size __m = 0x5bd1e995; + const _Size __r = 24; + _Size __h = __len; + const unsigned char* __data = static_cast<const unsigned char*>(__key); + for (; __len >= 4; __data += 4, __len -= 4) + { + _Size __k = std::__loadword<_Size>(__data); + __k *= __m; + __k ^= __k >> __r; + __k *= __m; + __h *= __m; + __h ^= __k; + } + switch (__len) + { + case 3: + __h ^= static_cast<_Size>(__data[2] << 16); + _LIBCPP_FALLTHROUGH(); + case 2: + __h ^= static_cast<_Size>(__data[1] << 8); + _LIBCPP_FALLTHROUGH(); + case 1: + __h ^= __data[0]; + __h *= __m; + } + __h ^= __h >> 13; + __h *= __m; + __h ^= __h >> 15; + return __h; + } }; -// murmur2 template <class _Size> -_Size -__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) +struct __murmur2_or_cityhash<_Size, 64> { - const _Size __m = 0x5bd1e995; - const _Size __r = 24; - _Size __h = __len; - const unsigned char* __data = static_cast<const unsigned char*>(__key); - for (; __len >= 4; __data += 4, __len -= 4) - { - _Size __k = std::__loadword<_Size>(__data); - __k *= __m; - __k ^= __k >> __r; - __k *= __m; - __h *= __m; - __h ^= __k; - } - switch (__len) - { - case 3: - __h ^= static_cast<_Size>(__data[2] << 16); - _LIBCPP_FALLTHROUGH(); - case 2: - __h ^= static_cast<_Size>(__data[1] << 8); - _LIBCPP_FALLTHROUGH(); - case 1: - __h ^= __data[0]; - __h *= __m; + // cityhash64 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + _Size operator()(const void* __key, _Size __len) const { + const char* __s = static_cast<const char*>(__key); + if (__len <= 32) { + if (__len <= 16) { + return __hash_len_0_to_16(__s, __len); + } else { + return __hash_len_17_to_32(__s, __len); + } + } else if (__len <= 64) { + return __hash_len_33_to_64(__s, __len); } - __h ^= __h >> 13; - __h *= __m; - __h ^= __h >> 15; - return __h; -} -template <class _Size> -struct __murmur2_or_cityhash<_Size, 64> -{ - inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; + // For strings over 64 bytes we hash the end first, and then as we + // loop we keep 56 bytes of state: v, w, x, y, and z. + _Size __x = std::__loadword<_Size>(__s + __len - 40); + _Size __y = std::__loadword<_Size>(__s + __len - 16) + + std::__loadword<_Size>(__s + __len - 56); + _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, + std::__loadword<_Size>(__s + __len - 24)); + pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); + pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); + __x = __x * __k1 + std::__loadword<_Size>(__s); + + // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. + __len = (__len - 1) & ~static_cast<_Size>(63); + do { + __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1; + __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1; + __x ^= __w.second; + __y += __v.first + std::__loadword<_Size>(__s + 40); + __z = __rotate(__z + __w.first, 33) * __k1; + __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); + __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, + __y + std::__loadword<_Size>(__s + 16)); + _VSTD::swap(__z, __x); + __s += 64; + __len -= 64; + } while (__len != 0); + return __hash_len_16( + __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, + __hash_len_16(__v.second, __w.second) + __x); + } - private: - // Some primes between 2^63 and 2^64. - static const _Size __k0 = 0xc3a5c85c97cb3127ULL; - static const _Size __k1 = 0xb492b66fbe98f273ULL; - static const _Size __k2 = 0x9ae16a3b2f90404fULL; - static const _Size __k3 = 0xc949d7c7509e6557ULL; + private: + // Some primes between 2^63 and 2^64. + static const _Size __k0 = 0xc3a5c85c97cb3127ULL; + static const _Size __k1 = 0xb492b66fbe98f273ULL; + static const _Size __k2 = 0x9ae16a3b2f90404fULL; + static const _Size __k3 = 0xc949d7c7509e6557ULL; + _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) { return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift))); } + _LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) { return (__val >> __shift) | (__val << (64 - __shift)); } + _LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); } - static _Size __hash_len_16(_Size __u, _Size __v) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_16(_Size __u, _Size __v) { const _Size __mul = 0x9ddfea08eb382d69ULL; _Size __a = (__u ^ __v) * __mul; __a ^= (__a >> 47); @@ -129,9 +169,8 @@ struct __murmur2_or_cityhash<_Size, 64> return __b; } - static _Size __hash_len_0_to_16(const char* __s, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_0_to_16(const char* __s, _Size __len) { if (__len > 8) { const _Size __a = std::__loadword<_Size>(__s); const _Size __b = std::__loadword<_Size>(__s + __len - 8); @@ -158,9 +197,8 @@ struct __murmur2_or_cityhash<_Size, 64> return __k2; } - static _Size __hash_len_17_to_32(const char *__s, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_17_to_32(const char *__s, _Size __len) { const _Size __a = std::__loadword<_Size>(__s) * __k1; const _Size __b = std::__loadword<_Size>(__s + 8); const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2; @@ -171,9 +209,9 @@ struct __murmur2_or_cityhash<_Size, 64> // Return a 16-byte hash for 48 bytes. Quick and dirty. // Callers do best to use "random-looking" values for a and b. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> __weak_hash_len_32_with_seeds( _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { __a += __w; __b = __rotate(__b + __a + __z, 21); @@ -185,9 +223,9 @@ struct __murmur2_or_cityhash<_Size, 64> } // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> __weak_hash_len_32_with_seeds( const char* __s, _Size __a, _Size __b) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s), std::__loadword<_Size>(__s + 8), @@ -198,9 +236,8 @@ struct __murmur2_or_cityhash<_Size, 64> } // Return an 8-byte hash for 33 to 64 bytes. - static _Size __hash_len_33_to_64(const char *__s, size_t __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_33_to_64(const char *__s, size_t __len) { _Size __z = std::__loadword<_Size>(__s + 24); _Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0; @@ -225,53 +262,6 @@ struct __murmur2_or_cityhash<_Size, 64> } }; -// cityhash64 -template <class _Size> -_Size -__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) -{ - const char* __s = static_cast<const char*>(__key); - if (__len <= 32) { - if (__len <= 16) { - return __hash_len_0_to_16(__s, __len); - } else { - return __hash_len_17_to_32(__s, __len); - } - } else if (__len <= 64) { - return __hash_len_33_to_64(__s, __len); - } - - // For strings over 64 bytes we hash the end first, and then as we - // loop we keep 56 bytes of state: v, w, x, y, and z. - _Size __x = std::__loadword<_Size>(__s + __len - 40); - _Size __y = std::__loadword<_Size>(__s + __len - 16) + - std::__loadword<_Size>(__s + __len - 56); - _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, - std::__loadword<_Size>(__s + __len - 24)); - pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); - pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); - __x = __x * __k1 + std::__loadword<_Size>(__s); - - // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. - __len = (__len - 1) & ~static_cast<_Size>(63); - do { - __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1; - __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1; - __x ^= __w.second; - __y += __v.first + std::__loadword<_Size>(__s + 40); - __z = __rotate(__z + __w.first, 33) * __k1; - __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); - __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, - __y + std::__loadword<_Size>(__s + 16)); - _VSTD::swap(__z, __x); - __s += 64; - __len -= 64; - } while (__len != 0); - return __hash_len_16( - __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, - __hash_len_16(__v.second, __w.second) + __x); -} - template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)> struct __scalar_hash; @@ -279,7 +269,7 @@ template <class _Tp> struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -297,7 +287,7 @@ template <class _Tp> struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -314,7 +304,7 @@ template <class _Tp> struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -335,7 +325,7 @@ template <class _Tp> struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -357,7 +347,7 @@ template <class _Tp> struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -381,7 +371,7 @@ struct _PairT { size_t second; }; -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { typedef __scalar_hash<_PairT> _HashT; const _PairT __p = {__lhs, __rhs}; @@ -392,7 +382,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT { union @@ -409,7 +399,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -417,7 +407,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -425,7 +415,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -433,7 +423,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -442,7 +432,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; #endif // !_LIBCPP_HAS_NO_CHAR8_T @@ -451,7 +441,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -459,7 +449,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -468,7 +458,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -477,7 +467,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -485,7 +475,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -493,7 +483,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -501,7 +491,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -509,7 +499,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -517,7 +507,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -553,7 +543,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -567,7 +557,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -581,7 +571,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -631,7 +621,7 @@ template <class _Tp, bool = is_enum<_Tp>::value> struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { typedef typename underlying_type<_Tp>::type type; @@ -650,13 +640,13 @@ struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <> struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; } @@ -677,7 +667,7 @@ using __has_enabled_hash _LIBCPP_NODEBUG = integral_constant<bool, is_default_constructible<_Hash>::value >; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Type, class> using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type; diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h index 2fe3acca08..5dffedf677 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/identity.h @@ -11,6 +11,7 @@ #define _LIBCPP___FUNCTIONAL_IDENTITY_H #include <__config> +#include <__type_traits/integral_constant.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -19,27 +20,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class _Tp> +struct __is_identity : false_type {}; + struct __identity { template <class _Tp> - _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT { + _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT { return std::forward<_Tp>(__t); } using is_transparent = void; }; -#if _LIBCPP_STD_VER > 17 +template <> +struct __is_identity<__identity> : true_type {}; + +#if _LIBCPP_STD_VER >= 20 struct identity { template<class _Tp> - _LIBCPP_NODISCARD_EXT constexpr _Tp&& operator()(_Tp&& __t) const noexcept + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept { return _VSTD::forward<_Tp>(__t); } using is_transparent = void; }; -#endif // _LIBCPP_STD_VER > 17 + +template <> +struct __is_identity<identity> : true_type {}; + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h index 48e6eac3ce..a7dd311074 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/invoke.h @@ -11,525 +11,16 @@ #define _LIBCPP___FUNCTIONAL_INVOKE_H #include <__config> -#include <__type_traits/add_lvalue_reference.h> -#include <__type_traits/apply_cv.h> -#include <__type_traits/conditional.h> -#include <__type_traits/decay.h> -#include <__type_traits/enable_if.h> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_base_of.h> -#include <__type_traits/is_core_convertible.h> -#include <__type_traits/is_member_function_pointer.h> -#include <__type_traits/is_member_object_pointer.h> -#include <__type_traits/is_reference_wrapper.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_void.h> -#include <__type_traits/nat.h> -#include <__type_traits/remove_cv.h> -#include <__utility/declval.h> +#include <__type_traits/invoke.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -// TODO: Disentangle the type traits and std::invoke properly - _LIBCPP_BEGIN_NAMESPACE_STD -struct __any -{ - __any(...); -}; - -template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> -struct __member_pointer_traits_imp -{ -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> -{ - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> -{ - typedef _Class const _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> -{ - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> -{ - typedef _Class volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> -{ - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> -{ - typedef _Class const volatile _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> -{ - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> -{ - typedef _Class& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> -{ - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> -{ - typedef _Class const& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> -{ - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> -{ - typedef _Class volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> -{ - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> -{ - typedef _Class const volatile& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> -{ - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> -{ - typedef _Class&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> -{ - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> -{ - typedef _Class const&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> -{ - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> -{ - typedef _Class volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> -{ - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param...); -}; - -template <class _Rp, class _Class, class ..._Param> -struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> -{ - typedef _Class const volatile&& _ClassType; - typedef _Rp _ReturnType; - typedef _Rp (_FnType) (_Param..., ...); -}; - -template <class _Rp, class _Class> -struct __member_pointer_traits_imp<_Rp _Class::*, false, true> -{ - typedef _Class _ClassType; - typedef _Rp _ReturnType; -}; - -template <class _MP> -struct __member_pointer_traits - : public __member_pointer_traits_imp<__remove_cv_t<_MP>, - is_member_function_pointer<_MP>::value, - is_member_object_pointer<_MP>::value> -{ -// typedef ... _ClassType; -// typedef ... _ReturnType; -// typedef ... _FnType; -}; - -template <class _DecayedFp> -struct __member_pointer_class_type {}; - -template <class _Ret, class _ClassType> -struct __member_pointer_class_type<_Ret _ClassType::*> { - typedef _ClassType type; -}; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet1 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet2 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet3 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet4 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet5 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet6 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -// __invoke forward declarations - -// fall back - none of the bullets - -template <class ..._Args> -__nat __invoke(__any, _Args&& ...__args); - -// bullets 1, 2 and 3 - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet1<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().*std::declval<_Fp>())(std::declval<_Args>()...)) -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - _NOEXCEPT_(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) - { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet2<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().get().*std::declval<_Fp>())(std::declval<_Args>()...)) -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - _NOEXCEPT_(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) - { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } - -template <class _Fp, class _A0, class ..._Args, - class = __enable_if_bullet3<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype(((*std::declval<_A0>()).*std::declval<_Fp>())(std::declval<_Args>()...)) -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - _NOEXCEPT_(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) - { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } - -// bullets 4, 5 and 6 - -template <class _Fp, class _A0, - class = __enable_if_bullet4<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().*std::declval<_Fp>()) -__invoke(_Fp&& __f, _A0&& __a0) - _NOEXCEPT_(noexcept(static_cast<_A0&&>(__a0).*__f)) - { return static_cast<_A0&&>(__a0).*__f; } - -template <class _Fp, class _A0, - class = __enable_if_bullet5<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().get().*std::declval<_Fp>()) -__invoke(_Fp&& __f, _A0&& __a0) - _NOEXCEPT_(noexcept(__a0.get().*__f)) - { return __a0.get().*__f; } - -template <class _Fp, class _A0, - class = __enable_if_bullet6<_Fp, _A0> > -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype((*std::declval<_A0>()).*std::declval<_Fp>()) -__invoke(_Fp&& __f, _A0&& __a0) - _NOEXCEPT_(noexcept((*static_cast<_A0&&>(__a0)).*__f)) - { return (*static_cast<_A0&&>(__a0)).*__f; } - -// bullet 7 - -template <class _Fp, class ..._Args> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR decltype(std::declval<_Fp>()(std::declval<_Args>()...)) -__invoke(_Fp&& __f, _Args&& ...__args) - _NOEXCEPT_(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) - { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } - -// __invokable -template <class _Ret, class _Fp, class ..._Args> -struct __invokable_r -{ - template <class _XFp, class ..._XArgs> - static decltype(std::__invoke(std::declval<_XFp>(), std::declval<_XArgs>()...)) __try_call(int); - template <class _XFp, class ..._XArgs> - static __nat __try_call(...); - - // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, - // or incomplete array types as required by the standard. - using _Result = decltype(__try_call<_Fp, _Args...>(0)); - - using type = __conditional_t< - _IsNotSame<_Result, __nat>::value, - __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >, - false_type>; - static const bool value = type::value; -}; -template <class _Fp, class ..._Args> -using __invokable = __invokable_r<void, _Fp, _Args...>; - -template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp { - static const bool value = false; -}; - -template <class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> -{ - typedef __nothrow_invokable_r_imp _ThisT; - - template <class _Tp> - static void __test_noexcept(_Tp) _NOEXCEPT; - -#ifdef _LIBCPP_CXX03_LANG - static const bool value = false; -#else - static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( - _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...))); -#endif -}; - -template <class _Ret, class _Fp, class ..._Args> -struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> -{ -#ifdef _LIBCPP_CXX03_LANG - static const bool value = false; -#else - static const bool value = noexcept( - _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...)); -#endif -}; - -template <class _Ret, class _Fp, class ..._Args> -using __nothrow_invokable_r = - __nothrow_invokable_r_imp< - __invokable_r<_Ret, _Fp, _Args...>::value, - is_void<_Ret>::value, - _Ret, _Fp, _Args... - >; - -template <class _Fp, class ..._Args> -using __nothrow_invokable = - __nothrow_invokable_r_imp< - __invokable<_Fp, _Args...>::value, - true, void, _Fp, _Args... - >; - -template <class _Fp, class ..._Args> -struct __invoke_of - : public enable_if< - __invokable<_Fp, _Args...>::value, - typename __invokable_r<void, _Fp, _Args...>::_Result> -{ -}; - -template <class _Ret, bool = is_void<_Ret>::value> -struct __invoke_void_return_wrapper -{ - template <class ..._Args> - static _Ret __call(_Args&&... __args) { - return std::__invoke(std::forward<_Args>(__args)...); - } -}; - -template <class _Ret> -struct __invoke_void_return_wrapper<_Ret, true> -{ - template <class ..._Args> - static void __call(_Args&&... __args) { - std::__invoke(std::forward<_Args>(__args)...); - } -}; - -#if _LIBCPP_STD_VER > 14 - -// is_invocable - -template <class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_invocable - : integral_constant<bool, __invokable<_Fn, _Args...>::value> {}; - -template <class _Ret, class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_invocable_r - : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; - -template <class _Fn, class ..._Args> -inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; - -template <class _Ret, class _Fn, class ..._Args> -inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; - -// is_nothrow_invocable - -template <class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable - : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {}; - -template <class _Ret, class _Fn, class ..._Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r - : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {}; - -template <class _Fn, class ..._Args> -inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; - -template <class _Ret, class _Fn, class ..._Args> -inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; - -template <class _Fn, class... _Args> -struct _LIBCPP_TEMPLATE_VIS invoke_result - : __invoke_of<_Fn, _Args...> -{ -}; - -template <class _Fn, class... _Args> -using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; +#if _LIBCPP_STD_VER >= 17 template <class _Fn, class ..._Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...> @@ -539,7 +30,26 @@ invoke(_Fn&& __f, _Args&&... __args) return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 + +#if _LIBCPP_STD_VER >= 23 +template <class _Result, class _Fn, class... _Args> + requires is_invocable_r_v<_Result, _Fn, _Args...> +_LIBCPP_HIDE_FROM_ABI constexpr _Result +invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) { + if constexpr (is_void_v<_Result>) { + static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...)); + } else { + // TODO: Use reference_converts_from_temporary_v once implemented + // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>; + // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>, + static_assert(true, + "Returning from invoke_r would bind a temporary object to the reference return type, " + "which would result in a dangling reference."); + return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); + } +} +#endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/is_transparent.h b/contrib/libs/cxxsupp/libcxx/include/__functional/is_transparent.h index c7a0ee9ee7..c539a07d69 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/is_transparent.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/is_transparent.h @@ -11,7 +11,8 @@ #define _LIBCPP___FUNCTIONAL_IS_TRANSPARENT #include <__config> -#include <type_traits> +#include <__type_traits/integral_constant.h> +#include <__type_traits/void_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class, class = void> struct __is_transparent : false_type {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h index 8b51627079..fe221dd128 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/mem_fn.h @@ -15,7 +15,6 @@ #include <__functional/invoke.h> #include <__functional/weak_result_type.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/not_fn.h b/contrib/libs/cxxsupp/libcxx/include/__functional/not_fn.h index 79d9a8710b..0cdb1b7e23 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/not_fn.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/not_fn.h @@ -13,8 +13,11 @@ #include <__config> #include <__functional/invoke.h> #include <__functional/perfect_forward.h> +#include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_move_constructible.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 struct __not_fn_op { template <class... _Args> @@ -47,7 +50,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) { return __not_fn_t<decay_t<_Fn>>(_VSTD::forward<_Fn>(__f)); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h b/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h index 8a781efbdb..6cdb89d6b4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/operations.h @@ -13,6 +13,9 @@ #include <__config> #include <__functional/binary_function.h> #include <__functional/unary_function.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/operation_traits.h> +#include <__type_traits/predicate_traits.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -23,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // Arithmetic operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -38,7 +41,15 @@ struct _LIBCPP_TEMPLATE_VIS plus }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus); -#if _LIBCPP_STD_VER > 11 +template <class _Tp> +struct __is_trivial_plus_operation<plus<_Tp>, _Tp, _Tp> : true_type {}; + +#if _LIBCPP_STD_VER >= 14 +template <class _Tp, class _Up> +struct __is_trivial_plus_operation<plus<>, _Tp, _Up> : true_type {}; +#endif + +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS plus<void> { @@ -52,7 +63,7 @@ struct _LIBCPP_TEMPLATE_VIS plus<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -67,7 +78,7 @@ struct _LIBCPP_TEMPLATE_VIS minus }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS minus<void> { @@ -81,7 +92,7 @@ struct _LIBCPP_TEMPLATE_VIS minus<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -96,7 +107,7 @@ struct _LIBCPP_TEMPLATE_VIS multiplies }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS multiplies<void> { @@ -110,7 +121,7 @@ struct _LIBCPP_TEMPLATE_VIS multiplies<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -125,7 +136,7 @@ struct _LIBCPP_TEMPLATE_VIS divides }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS divides<void> { @@ -139,7 +150,7 @@ struct _LIBCPP_TEMPLATE_VIS divides<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -154,7 +165,7 @@ struct _LIBCPP_TEMPLATE_VIS modulus }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS modulus<void> { @@ -168,7 +179,7 @@ struct _LIBCPP_TEMPLATE_VIS modulus<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -183,7 +194,7 @@ struct _LIBCPP_TEMPLATE_VIS negate }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS negate<void> { @@ -199,7 +210,7 @@ struct _LIBCPP_TEMPLATE_VIS negate<void> // Bitwise operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -214,7 +225,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_and }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_and<void> { @@ -228,7 +239,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_and<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> @@ -252,7 +263,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_not<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -267,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_or }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_or<void> { @@ -281,7 +292,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_or<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -296,7 +307,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_xor<void> { @@ -312,7 +323,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor<void> // Comparison operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -327,7 +338,7 @@ struct _LIBCPP_TEMPLATE_VIS equal_to }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS equal_to<void> { @@ -341,7 +352,15 @@ struct _LIBCPP_TEMPLATE_VIS equal_to<void> }; #endif -#if _LIBCPP_STD_VER > 11 +template <class _Tp> +struct __is_trivial_equality_predicate<equal_to<_Tp>, _Tp, _Tp> : true_type {}; + +#if _LIBCPP_STD_VER >= 14 +template <class _Tp> +struct __is_trivial_equality_predicate<equal_to<>, _Tp, _Tp> : true_type {}; +#endif + +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -356,7 +375,7 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> { @@ -370,7 +389,7 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -385,7 +404,7 @@ struct _LIBCPP_TEMPLATE_VIS less }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS less<void> { @@ -399,7 +418,7 @@ struct _LIBCPP_TEMPLATE_VIS less<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -414,7 +433,7 @@ struct _LIBCPP_TEMPLATE_VIS less_equal }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS less_equal<void> { @@ -428,7 +447,7 @@ struct _LIBCPP_TEMPLATE_VIS less_equal<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -443,7 +462,7 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS greater_equal<void> { @@ -457,7 +476,7 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -472,7 +491,7 @@ struct _LIBCPP_TEMPLATE_VIS greater }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS greater<void> { @@ -488,7 +507,7 @@ struct _LIBCPP_TEMPLATE_VIS greater<void> // Logical operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -503,7 +522,7 @@ struct _LIBCPP_TEMPLATE_VIS logical_and }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_and<void> { @@ -517,7 +536,7 @@ struct _LIBCPP_TEMPLATE_VIS logical_and<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -532,7 +551,7 @@ struct _LIBCPP_TEMPLATE_VIS logical_not }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_not<void> { @@ -546,7 +565,7 @@ struct _LIBCPP_TEMPLATE_VIS logical_not<void> }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -561,7 +580,7 @@ struct _LIBCPP_TEMPLATE_VIS logical_or }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_or<void> { diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h b/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h index 9ffea1a8c7..b848fbf696 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/perfect_forward.h @@ -11,19 +11,25 @@ #define _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H #include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/invoke.h> +#include <__type_traits/is_constructible.h> #include <__utility/declval.h> #include <__utility/forward.h> +#include <__utility/integer_sequence.h> #include <__utility/move.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Op, class _Indices, class... _BoundArgs> struct __perfect_forward_impl; @@ -37,14 +43,14 @@ public: template <class... _Args, class = enable_if_t< is_constructible_v<tuple<_BoundArgs...>, _Args&&...> >> - explicit constexpr __perfect_forward_impl(_Args&&... __bound_args) + _LIBCPP_HIDE_FROM_ABI explicit constexpr __perfect_forward_impl(_Args&&... __bound_args) : __bound_args_(_VSTD::forward<_Args>(__bound_args)...) {} - __perfect_forward_impl(__perfect_forward_impl const&) = default; - __perfect_forward_impl(__perfect_forward_impl&&) = default; + _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl const&) = default; + _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default; - __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default; - __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default; + _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default; + _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default; template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>> _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & @@ -87,8 +93,10 @@ public: template <class _Op, class ..._Args> using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h b/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h index 87081dd56a..c344fc38f9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/ranges_operations.h @@ -13,6 +13,8 @@ #include <__concepts/equality_comparable.h> #include <__concepts/totally_ordered.h> #include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/predicate_traits.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -21,14 +23,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { struct equal_to { template <class _Tp, class _Up> requires equality_comparable_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u)))) { return _VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u); } @@ -39,7 +41,7 @@ struct equal_to { struct not_equal_to { template <class _Tp, class _Up> requires equality_comparable_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u))))) { return !(_VSTD::forward<_Tp>(__t) == _VSTD::forward<_Up>(__u)); } @@ -50,7 +52,7 @@ struct not_equal_to { struct less { template <class _Tp, class _Up> requires totally_ordered_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u)))) { return _VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u); } @@ -61,7 +63,7 @@ struct less { struct less_equal { template <class _Tp, class _Up> requires totally_ordered_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(!(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t))))) { return !(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t)); } @@ -72,7 +74,7 @@ struct less_equal { struct greater { template <class _Tp, class _Up> requires totally_ordered_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(_VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t)))) { return _VSTD::forward<_Up>(__u) < _VSTD::forward<_Tp>(__t); } @@ -83,7 +85,7 @@ struct greater { struct greater_equal { template <class _Tp, class _Up> requires totally_ordered_with<_Tp, _Up> - [[nodiscard]] constexpr bool operator()(_Tp &&__t, _Up &&__u) const + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp &&__t, _Up &&__u) const noexcept(noexcept(bool(!(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u))))) { return !(_VSTD::forward<_Tp>(__t) < _VSTD::forward<_Up>(__u)); } @@ -93,7 +95,10 @@ struct greater_equal { } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +template <class _Lhs, class _Rhs> +struct __is_trivial_equality_predicate<ranges::equal_to, _Lhs, _Rhs> : true_type {}; + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h index c377b64377..2d382a34f6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/reference_wrapper.h @@ -55,12 +55,18 @@ public: template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<type&, _ArgTypes...>::type - operator() (_ArgTypes&&... __args) const { + operator() (_ArgTypes&&... __args) const +#if _LIBCPP_STD_VER >= 17 + // Since is_nothrow_invocable requires C++17 LWG3764 is not backported + // to earlier versions. + noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>) +#endif + { return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); } }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/unwrap_ref.h b/contrib/libs/cxxsupp/libcxx/include/__functional/unwrap_ref.h deleted file mode 100644 index da000d80b8..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/unwrap_ref.h +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___FUNCTIONAL_UNWRAP_REF_H -#define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H - -#include <__config> -#include <__type_traits/decay.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; }; - -template <class _Tp> -class reference_wrapper; - -template <class _Tp> -struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG _Tp& type; }; - -template <class _Tp> -struct decay; - -#if _LIBCPP_STD_VER > 17 -template <class _Tp> -struct unwrap_reference : __unwrap_reference<_Tp> { }; - -template <class _Tp> -using unwrap_reference_t = typename unwrap_reference<_Tp>::type; - -template <class _Tp> -struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { }; - -template <class _Tp> -using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; -#endif // > C++17 - -template <class _Tp> -struct __unwrap_ref_decay -#if _LIBCPP_STD_VER > 17 - : unwrap_ref_decay<_Tp> -#else - : __unwrap_reference<typename decay<_Tp>::type> -#endif -{ }; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H |