mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-04 13:41:02 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
49
third_party/libcxx/__algorithm/make_projected.h
vendored
49
third_party/libcxx/__algorithm/make_projected.h
vendored
|
@ -36,44 +36,38 @@ struct _ProjectedPred {
|
|||
: __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 _LIBCPP_HIDE_FROM_ABI operator()(_Tp&& __v) const {
|
||||
typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>()))>::type
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
|
||||
operator()(_Tp&& __v) const {
|
||||
return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v)));
|
||||
}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
typename __invoke_of<_Pred&,
|
||||
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())),
|
||||
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>()))
|
||||
>::type
|
||||
_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)));
|
||||
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>()))>::type _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)));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
// 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,
|
||||
__enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value &&
|
||||
__is_identity<__decay_t<_Proj> >::value,
|
||||
int> = 0>
|
||||
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;
|
||||
}
|
||||
|
@ -87,8 +81,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
namespace ranges {
|
||||
|
||||
template <class _Comp, class _Proj1, class _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) {
|
||||
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
|
||||
|
@ -96,10 +89,10 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p
|
|||
return __comp;
|
||||
|
||||
} else {
|
||||
return [&](auto&& __lhs, auto&& __rhs) {
|
||||
return [&](auto&& __lhs, auto&& __rhs) -> bool {
|
||||
return std::invoke(__comp,
|
||||
std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
|
||||
std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
|
||||
std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)),
|
||||
std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs)));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue