]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: drop != operator and use friend operator==
authorKefu Chai <tchaikov@gmail.com>
Tue, 1 Mar 2022 16:10:32 +0000 (00:10 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 30 Jul 2022 05:02:15 +0000 (13:02 +0800)
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 <bool> (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 <tchaikov@gmail.com>
src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h

index a2e633fe5b04f918331c9fafb40e1be5acb9603b..06a1dcb6465e1226e92bd25491ff5e16b2740577 100644 (file)
@@ -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: