[libcxx-commits] [libcxx] [libc++][spaceship] P2404R3: Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with (PR #99420)

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 18 10:14:05 PDT 2024


================
@@ -37,6 +38,20 @@ concept three_way_comparable =
       { __a <=> __b } -> __compares_as<_Cat>;
     };
 
+#  if _LIBCPP_STD_VER >= 23
+
+template <class _Tp, class _Up, class _Cat = partial_ordering>
+concept three_way_comparable_with =
+    three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> && __comparison_common_type_with<_Tp, _Up> &&
+    three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
+    __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
+    requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
+      { __t <=> __u } -> __compares_as<_Cat>;
+      { __u <=> __t } -> __compares_as<_Cat>;
+    };
----------------
cjdb wrote:

Rather than spelling the definition out twice, can you make `__common_comparison_type_with` available in C++20, with the value of `true`, please?

https://github.com/llvm/llvm-project/pull/99420


More information about the libcxx-commits mailing list