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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 07:11:38 PDT 2024


================
@@ -223,4 +224,31 @@ struct SpaceshipNonConstArgument {
 };
 
 static_assert(!check_three_way_comparable_with<SpaceshipNonConstArgument>());
+
+struct MoveOnlyIntComparable {
+  MoveOnlyIntComparable(int) {}
+
+  MoveOnlyIntComparable(MoveOnlyIntComparable&&)            = default;
+  MoveOnlyIntComparable& operator=(MoveOnlyIntComparable&&) = default;
+
+  friend auto operator<=>(MoveOnlyIntComparable const&, MoveOnlyIntComparable const&) = default;
+};
+
+#if TEST_STD_VER < 23
+static_assert(!check_three_way_comparable_with<MoveOnlyIntComparable, int>());
+#else
+static_assert(check_three_way_comparable_with<MoveOnlyIntComparable, int>());
----------------
ldionne wrote:

```suggestion
#else
// P2404
static_assert(check_three_way_comparable_with<MoveOnlyIntComparable, int>());
```

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


More information about the libcxx-commits mailing list