integer-range-set.hpp: add `begin()` and `end()` to bt2::CommonIntegerRangeSet
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 11 Mar 2022 17:30:06 +0000 (12:30 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 11 Sep 2023 15:24:02 +0000 (11:24 -0400)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I85d92d27f90f25b2f86780180b248bde3c394b20
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7568
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10795
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/cpp-common/bt2/integer-range-set.hpp

index 6cb17af00b21665ad4463e21328b6f09196c8079..22ff4da18e6c96c56e22c8acacbcc402c095a917 100644 (file)
@@ -11,6 +11,7 @@
 #include <type_traits>
 #include <babeltrace2/babeltrace.h>
 
+#include "common-iter.hpp"
 #include "internal/borrowed-obj.hpp"
 #include "internal/utils.hpp"
 #include "integer-range.hpp"
@@ -177,6 +178,7 @@ public:
         ConstUnsignedIntegerRange, ConstSignedIntegerRange>::type;
 
     using Value = typename Range::Value;
+    using Iterator = CommonIterator<CommonIntegerRangeSet, Range>;
 
     explicit CommonIntegerRangeSet(const _LibObjPtr libObjPtr) noexcept :
         _ThisBorrowedObj {libObjPtr}
@@ -238,6 +240,16 @@ public:
         return Range {_Spec::rangeByIndex(this->libObjPtr(), index)};
     }
 
+    Iterator begin() const noexcept
+    {
+        return Iterator {*this, 0};
+    }
+
+    Iterator end() const noexcept
+    {
+        return Iterator {*this, this->size()};
+    }
+
     Shared shared() const noexcept
     {
         return Shared {*this};
This page took 0.025219 seconds and 4 git commands to generate.