[libcxx-commits] [libcxx] [libc++][spaceship] P2404R3: Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with (PR #99420)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 18 07:06:21 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>());
+#endif // TEST_STD_VER >= 23
+
+struct ImmobileIntComparable {
----------------
Zingam wrote:
Do you mean `NonMovable`? For consistency:
```suggestion
struct NonMovableIntComparable{
```
`Movable` vs `NonMovable` is what is used in the tests suite mostrly.
https://github.com/llvm/llvm-project/pull/99420
More information about the libcxx-commits
mailing list