mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add RangeSet::lebesgue_sum
This commit is contained in:
@@ -57,6 +57,10 @@ public:
|
||||
|
||||
std::string toString () const;
|
||||
|
||||
/** Returns the sum of the Lebesgue measures of all sub-ranges. */
|
||||
std::size_t
|
||||
lebesgue_sum() const;
|
||||
|
||||
/** Check invariants of the data.
|
||||
|
||||
This is for diagnostics, and does nothing in release builds.
|
||||
|
||||
@@ -235,6 +235,15 @@ void RangeSet::simplify ()
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t
|
||||
RangeSet::lebesgue_sum() const
|
||||
{
|
||||
std::size_t sum = mRanges.size();
|
||||
for (auto const& e : mRanges)
|
||||
sum += e.second - e.first;
|
||||
return sum;
|
||||
}
|
||||
|
||||
void RangeSet::checkInternalConsistency () const noexcept
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
|
||||
Reference in New Issue
Block a user