From: Kefu Chai Date: Fri, 20 Jun 2025 07:31:56 +0000 (+0800) Subject: osd/ECExtentCache: use default-generated comparison operators X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=19b4468c930085573ca0078e00a08182115da1bc;p=ceph.git osd/ECExtentCache: use default-generated comparison operators 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 --- diff --git a/src/osd/ECExtentCache.h b/src/osd/ECExtentCache.h index b4e06d6fddfd..0198cb331cda 100644 --- a/src/osd/ECExtentCache.h +++ b/src/osd/ECExtentCache.h @@ -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 {