Skip to content

Commit af02e09

Browse files
committed
[libc++] Restore __synth_three_way lambda
1 parent b8d0cba commit af02e09

File tree

8 files changed

+11
-27
lines changed

8 files changed

+11
-27
lines changed

libcxx/include/__compare/synth_three_way.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2525

2626
// [expos.only.func]
2727

28-
// TODO MODULES restore the lamba to match the Standard.
29-
// See https://github.com/llvm/llvm-project/issues/57222
30-
//_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way =
31-
// []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
32-
template <class _Tp, class _Up>
33-
_LIBCPP_HIDE_FROM_ABI constexpr auto __synth_three_way(const _Tp& __t, const _Up& __u)
28+
_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
3429
requires requires {
3530
{ __t < __u } -> __boolean_testable;
3631
{ __u < __t } -> __boolean_testable;
@@ -45,7 +40,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __synth_three_way(const _Tp& __t, const _Up
4540
return weak_ordering::greater;
4641
return weak_ordering::equivalent;
4742
}
48-
}
43+
};
4944

5045
template <class _Tp, class _Up = _Tp>
5146
using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>()));

libcxx/include/array

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ template <class _Tp, size_t _Size>
423423
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
424424
operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
425425
return std::lexicographical_compare_three_way(
426-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
426+
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
427427
}
428428

429429
#endif // _LIBCPP_STD_VER <= 17

libcxx/include/deque

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ template <class _Tp, class _Allocator>
25232523
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
25242524
operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
25252525
return std::lexicographical_compare_three_way(
2526-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
2526+
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
25272527
}
25282528

25292529
#endif // _LIBCPP_STD_VER <= 17

libcxx/include/forward_list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ template <class _Tp, class _Allocator>
15241524
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
15251525
operator<=>(const forward_list<_Tp, _Allocator>& __x, const forward_list<_Tp, _Allocator>& __y) {
15261526
return std::lexicographical_compare_three_way(
1527-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
1527+
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
15281528
}
15291529

15301530
#endif // #if _LIBCPP_STD_VER <= 17

libcxx/include/list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ template <class _Tp, class _Allocator>
16871687
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
16881688
operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) {
16891689
return std::lexicographical_compare_three_way(
1690-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
1690+
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
16911691
}
16921692

16931693
#endif // _LIBCPP_STD_VER <= 17

libcxx/include/map

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,12 +1623,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
16231623
template <class _Key, class _Tp, class _Compare, class _Allocator>
16241624
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
16251625
operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
1626-
return std::lexicographical_compare_three_way(
1627-
__x.begin(),
1628-
__x.end(),
1629-
__y.begin(),
1630-
__y.end(),
1631-
std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
1626+
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
16321627
}
16331628

16341629
#endif // #if _LIBCPP_STD_VER <= 17
@@ -2144,12 +2139,7 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
21442139
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
21452140
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
21462141
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
2147-
return std::lexicographical_compare_three_way(
2148-
__x.begin(),
2149-
__x.end(),
2150-
__y.begin(),
2151-
__y.end(),
2152-
std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
2142+
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
21532143
}
21542144

21552145
#endif // #if _LIBCPP_STD_VER <= 17

libcxx/include/set

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
996996
template <class _Key, class _Allocator>
997997
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
998998
operator<=>(const set<_Key, _Allocator>& __x, const set<_Key, _Allocator>& __y) {
999-
return std::lexicographical_compare_three_way(
1000-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
999+
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
10011000
}
10021001

10031002
#endif // _LIBCPP_STD_VER <= 17
@@ -1457,7 +1456,7 @@ template <class _Key, class _Allocator>
14571456
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
14581457
operator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) {
14591458
return std::lexicographical_compare_three_way(
1460-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Key, _Key>);
1459+
__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
14611460
}
14621461

14631462
#endif // _LIBCPP_STD_VER <= 17

libcxx/include/vector

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,7 @@ template <class _Tp, class _Allocator>
29062906
_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp>
29072907
operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) {
29082908
return std::lexicographical_compare_three_way(
2909-
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
2909+
__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
29102910
}
29112911

29122912
#endif // _LIBCPP_STD_VER <= 17

0 commit comments

Comments
 (0)