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/__algorithm/make_projected.h | |
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/__algorithm/make_projected.h')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h index 87d4d59042..ec854763a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_projected.h @@ -32,13 +32,14 @@ struct _ProjectedPred { _Pred& __pred; // Can be a unary or a binary predicate. _Proj& __proj; - _LIBCPP_CONSTEXPR _ProjectedPred(_Pred& __pred_arg, _Proj& __proj_arg) : __pred(__pred_arg), __proj(__proj_arg) {} + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _ProjectedPred(_Pred& __pred_arg, _Proj& __proj_arg) + : __pred(__pred_arg), __proj(__proj_arg) {} template <class _Tp> typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>())) >::type - _LIBCPP_CONSTEXPR operator()(_Tp&& __v) const { + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_Tp&& __v) const { return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v))); } @@ -47,7 +48,7 @@ struct _ProjectedPred { decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())), decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>())) >::type - _LIBCPP_CONSTEXPR operator()(_T1&& __lhs, _T2&& __rhs) const { + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI operator()(_T1&& __lhs, _T2&& __rhs) const { return std::__invoke(__pred, std::__invoke(__proj, std::forward<_T1>(__lhs)), std::__invoke(__proj, std::forward<_T2>(__rhs))); @@ -55,25 +56,12 @@ struct _ProjectedPred { }; -template <class _Pred, class _Proj, class = void> -struct __can_use_pristine_comp : false_type {}; - -template <class _Pred, class _Proj> -struct __can_use_pristine_comp<_Pred, _Proj, __enable_if_t< - !is_member_pointer<typename decay<_Pred>::type>::value && ( -#if _LIBCPP_STD_VER > 17 - is_same<typename decay<_Proj>::type, identity>::value || -#endif - is_same<typename decay<_Proj>::type, __identity>::value - ) -> > : true_type {}; - -template <class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static -__enable_if_t< - !__can_use_pristine_comp<_Pred, _Proj>::value, - _ProjectedPred<_Pred, _Proj> -> +template <class _Pred, + class _Proj, + __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value && + __is_identity<__decay_t<_Proj> >::value), + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) { return _ProjectedPred<_Pred, _Proj>(__pred, __proj); } @@ -81,28 +69,27 @@ __make_projected(_Pred& __pred, _Proj& __proj) { // Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in // the call stack when the comparator is invoked, even in an unoptimized build. -template <class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static -__enable_if_t< - __can_use_pristine_comp<_Pred, _Proj>::value, - _Pred& -> -__make_projected(_Pred& __pred, _Proj&) { +template <class _Pred, + class _Proj, + __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value && + __is_identity<__decay_t<_Proj> >::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) { return __pred; } _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <class _Comp, class _Proj1, class _Proj2> -_LIBCPP_HIDE_FROM_ABI constexpr static +_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { - if constexpr (same_as<decay_t<_Proj1>, identity> && same_as<decay_t<_Proj2>, identity> && + if constexpr (__is_identity<decay_t<_Proj1>>::value && __is_identity<decay_t<_Proj2>>::value && !is_member_pointer_v<decay_t<_Comp>>) { // Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. @@ -121,6 +108,6 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H |