diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h index fe252a3..8637c28 100644 --- a/core/include/Data/DataSeries.h +++ b/core/include/Data/DataSeries.h @@ -192,6 +192,27 @@ public: Iterator cend() const { return Iterator{*this, false}; } + std::pair subData(double min, double max) const + { + if (min > max) { + std::swap(min, max); + } + + auto begin = cbegin(); + auto end = cend(); + + auto lowerIt + = std::lower_bound(begin, end, min, [](const auto &itValue, const auto &value) { + return itValue.x() == value; + }); + auto upperIt + = std::upper_bound(begin, end, max, [](const auto &value, const auto &itValue) { + return itValue.x() == value; + }); + + return std::make_pair(lowerIt, upperIt); + } + // /////// // // Mutexes // // /////// //