]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ECExtentCache: use default-generated comparison operators
authorKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 07:31:56 +0000 (15:31 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 20 Jun 2025 10:00:49 +0000 (18:00 +0800)
Replace manually implemented operator== and operator!= for Key with
compiler-generated defaults. In C++20, comparison operators can be
explicitly defaulted, and the generated behavior is identical to our
hand-crafted implementation.

This simplifies the code by letting the compiler handle operator
generation automatically.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/osd/ECExtentCache.h

index b4e06d6fddfd0bfb48a64c98b8e822f993795bfa..0198cb331cda4e08a4967e0b7fe7d163eb5090ec 100644 (file)
@@ -111,14 +111,7 @@ class ECExtentCache {
 
       Key(uint64_t offset, const hobject_t &oid) : offset(offset), oid(oid) {};
 
-      friend bool operator==(const Key &lhs, const Key &rhs) {
-        return lhs.offset == rhs.offset
-            && lhs.oid == rhs.oid;
-      }
-
-      friend bool operator!=(const Key &lhs, const Key &rhs) {
-        return !(lhs == rhs);
-      }
+      bool operator==(const Key&) const = default;
     };
 
     struct KeyHash {