Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Restore __synth_three_way lambda #90398

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions libcxx/include/__compare/synth_three_way.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD

// [expos.only.func]

// TODO MODULES restore the lamba to match the Standard.
// See https://github.com/llvm/llvm-project/issues/57222
//_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way =
// []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
template <class _Tp, class _Up>
_LIBCPP_HIDE_FROM_ABI constexpr auto __synth_three_way(const _Tp& __t, const _Up& __u)
_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
requires requires {
{ __t < __u } -> __boolean_testable;
{ __u < __t } -> __boolean_testable;
Expand All @@ -45,7 +40,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __synth_three_way(const _Tp& __t, const _Up
return weak_ordering::greater;
return weak_ordering::equivalent;
}
}
};

template <class _Tp, class _Up = _Tp>
using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>()));
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/array
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ template <class _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/deque
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const forward_list<_Tp, _Allocator>& __x, const forward_list<_Tp, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // #if _LIBCPP_STD_VER <= 17
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/list
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down
14 changes: 2 additions & 12 deletions libcxx/include/map
Original file line number Diff line number Diff line change
Expand Up @@ -1617,12 +1617,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(),
__x.end(),
__y.begin(),
__y.end(),
std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // #if _LIBCPP_STD_VER <= 17
Expand Down Expand Up @@ -2136,12 +2131,7 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(),
__x.end(),
__y.begin(),
__y.end(),
std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
}

#endif // #if _LIBCPP_STD_VER <= 17
Expand Down
5 changes: 2 additions & 3 deletions libcxx/include/set
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const set<_Key, _Allocator>& __x, const set<_Key, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down Expand Up @@ -1454,7 +1453,7 @@ template <class _Key, class _Allocator>
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
operator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/vector
Original file line number Diff line number Diff line change
Expand Up @@ -2903,7 +2903,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
return std::lexicographical_compare_three_way(
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}

#endif // _LIBCPP_STD_VER <= 17
Expand Down
Loading