From: Alex Ainscow Date: Wed, 8 Jan 2025 22:08:23 +0000 (+0000) Subject: interval_map: contains() to determine if range is entirely contained within range. X-Git-Tag: v20.0.0~286^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8cd072d8e02c2dbaca0d0c8272d5220abdb35f14;p=ceph.git interval_map: contains() to determine if range is entirely contained within range. Determine, for a particular interval iterator, whether the specified range is entirely contained inside the interval. Signed-off-by: Alex Ainscow --- diff --git a/src/common/interval_map.h b/src/common/interval_map.h index e57fac539a9d..bbd14693ce08 100644 --- a/src/common/interval_map.h +++ b/src/common/interval_map.h @@ -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());