]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
interval_map: contains() to determine if range is entirely contained within range.
authorAlex Ainscow <aainscow@uk.ibm.com>
Wed, 8 Jan 2025 22:08:23 +0000 (22:08 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Mon, 27 Jan 2025 11:20:01 +0000 (11:20 +0000)
Determine, for a particular interval iterator, whether the specified range is entirely contained inside the interval.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/common/interval_map.h

index e57fac539a9d8226cd968c1003e6002851443bd1..bbd14693ce08f072ac93d53279bf1529868f77ee 100644 (file)
@@ -255,6 +255,11 @@ public:
     const_iterator &operator*() {
       return *this;
     }
+    constexpr bool contains(K _off, K _len) const {
+      K off = get_off();
+      K len = get_len();
+      return off <= _off && off + len >= _off + _len;
+    }
   };
   const_iterator begin() const {
     return const_iterator(m.begin());