From 936481e0a7fb1a6b516685e5163e6b73a21b8dc8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 2 Mar 2022 00:10:32 +0800 Subject: [PATCH] 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 --- .../omap_manager/btree/string_kv_node_layout.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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: -- 2.39.5