From: Kefu Chai Date: Tue, 1 Mar 2022 16:10:32 +0000 (+0800) Subject: crimson/os/seastore: drop != operator and use friend operator== X-Git-Tag: v18.0.0~366^2~12 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=936481e0a7fb1a6b516685e5163e6b73a21b8dc8;p=ceph-ci.git crimson/os/seastore: drop != operator and use friend operator== C++20 is able to create != from == operator. so drop the != overload. this helps to address following FTBFS: /var/ssd/ceph/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc:141:19: error: use of overloaded operator '!=' is ambiguous (with operand types 'crimson::os::seastore::omap_manager::StringKVInnerN$ assert(child_pt != iter_end()); ~~~~~~~~ ^ ~~~~~~~~~~ /usr/include/assert.h:93:27: note: expanded from macro 'assert' (static_cast (expr) \ ^~~~ /var/ssd/ceph/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h:380:10: note: candidate function bool operator==(const iter_t &rhs) const { ^ Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h b/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h index a2e633fe5b0..06a1dcb6465 100644 --- a/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h +++ b/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h @@ -377,13 +377,9 @@ public: return index > rhs.index; } - bool operator==(const iter_t &rhs) const { - assert(node == rhs.node); - return rhs.index == index; - } - - bool operator!=(const iter_t &rhs) const { - return !(*this == rhs); + friend bool operator==(const iter_t &lhs, const iter_t &rhs) { + assert(lhs.node == rhs.node); + return lhs.index == rhs.index; } private: