[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:04 PDT 2024


================
@@ -529,4 +529,27 @@ struct ForwardingTestObject {
   constexpr bool operator>=(const ForwardingTestObject&) const& { return false; }
 };
 
+struct move_only_equality_with_int {
+  move_only_equality_with_int(int);
+
+  move_only_equality_with_int(move_only_equality_with_int&&)            = default;
+  move_only_equality_with_int& operator=(move_only_equality_with_int&&) = default;
+
+  move_only_equality_with_int(move_only_equality_with_int const&)            = delete;
+  move_only_equality_with_int& operator=(move_only_equality_with_int const&) = delete;
+
+  friend bool operator==(move_only_equality_with_int const&, move_only_equality_with_int const&) = default;
+  friend bool operator==(move_only_equality_with_int const&, int);
+};
+
+struct nonmovable_equality_with_int {
+  nonmovable_equality_with_int(int);
+
+  nonmovable_equality_with_int(nonmovable_equality_with_int&&)            = delete;
+  nonmovable_equality_with_int& operator=(nonmovable_equality_with_int&&) = delete;
----------------
cjdb wrote:

I typically like to see all the special members spelt out for readability.

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


More information about the libcxx-commits mailing list