]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common/fixed_kv_node_layout: add iterator operator-- and misc
authorSamuel Just <sjust@redhat.com>
Thu, 19 Aug 2021 05:11:30 +0000 (22:11 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 26 Aug 2021 20:49:13 +0000 (13:49 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/fixed_kv_node_layout.h

index 75cddb3f01090200c09645c6317903413466752a..b13302881b82dedacc8f210544caa66cbc4054bb 100644 (file)
@@ -59,14 +59,15 @@ public:
     using parent_t = typename maybe_const_t<FixedKVNodeLayout, is_const>::type;
 
     parent_t node;
-    uint16_t offset;
+    uint16_t offset = 0;
 
+    iter_t() = default;
     iter_t(
       parent_t parent,
       uint16_t offset) : node(parent), offset(offset) {}
 
-    iter_t(const iter_t &) = default;
-    iter_t(iter_t &&) = default;
+    iter_t(const iter_t &) noexcept = default;
+    iter_t(iter_t &&) noexcept = default;
     iter_t &operator=(const iter_t &) = default;
     iter_t &operator=(iter_t &&) = default;
 
@@ -91,6 +92,19 @@ public:
       return *this;
     }
 
+    iter_t operator--(int) {
+      assert(offset > 0);
+      auto ret = *this;
+      --offset;
+      return ret;
+    }
+
+    iter_t &operator--() {
+      assert(offset > 0);
+      --offset;
+      return *this;
+    }
+
     uint16_t operator-(const iter_t &rhs) const {
       assert(rhs.node == node);
       return offset - rhs.offset;