// [expos.only.func]
-_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;
- }
- {
- if constexpr (three_way_comparable_with<_Tp, _Up>) {
- return __t <=> __u;
- } else {
- if (__t < __u) return weak_ordering::less;
- if (__u < __t) return weak_ordering::greater;
- return weak_ordering::equivalent;
- }
- };
+// 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)
+ requires requires {
+ { __t < __u } -> __boolean_testable;
+ { __u < __t } -> __boolean_testable;
+ }
+{
+ if constexpr (three_way_comparable_with<_Tp, _Up>) {
+ return __t <=> __u;
+ } else {
+ if (__t < __u)
+ return weak_ordering::less;
+ if (__u < __t)
+ 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&>()));
#include <__compare/ordering.h>
#include <__compare/partial_order.h>
#include <__compare/strong_order.h>
+#include <__compare/synth_three_way.h>
#include <__compare/three_way_comparable.h>
#include <__compare/weak_order.h>
#include <__config>
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(), __synth_three_way);
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
const forward_list<_Tp, _Allocator>& __y)
{
return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // #if _LIBCPP_STD_VER <= 17
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(), __synth_three_way);
+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>);
}
#endif // _LIBCPP_STD_VER <= 17
const map<_Key, _Tp, _Compare, _Allocator>& __y)
{
return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
{
return std::lexicographical_compare_three_way(
- __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
+ __x.begin(),
+ __x.end(),
+ __y.begin(),
+ __y.end(),
+ std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>);
}
#endif // #if _LIBCPP_STD_VER <= 17
libcxx/include/__compare/ordering.h
libcxx/include/__compare/partial_order.h
libcxx/include/__compare/strong_order.h
-libcxx/include/__compare/synth_three_way.h
libcxx/include/__compare/three_way_comparable.h
libcxx/include/__compare/weak_order.h
libcxx/include/complex