#include <interval.hpp>
◆ IntervalSet()
template<std::integral T>
◆ defragment()
template<std::integral T>
Merges adjacent intervals to reduce fragmentation.
◆ getIntervals()
template<std::integral T>
Retrieves all intervals in the set.
- Returns
- A vector of pairs representing intervals [left, right).
◆ query() [1/2]
template<std::integral T>
Checks if a given interval intersects with any intervals in the set.
- Parameters
-
interval | The interval to check for intersection. |
- Returns
- True if the interval intersects with any existing intervals; otherwise, false.
◆ query() [2/2]
template<std::integral T>
Checks if a given index is within any of the intervals in the set.
- Parameters
-
- Returns
- True if the index is within an interval; otherwise, false.
◆ update()
template<std::integral T>
Updates the interval set by adding a new interval specified by left (inclusive) and right (exclusive) boundaries. If the new interval overlaps with existing intervals, they will be merged into a single interval. But there might be fragmentation!
- Parameters
-
left | The starting boundary of the interval to add, inclusive. |
right | The ending boundary of the interval to add, exclusive. Must be greater than left. |
this is non-trivial
The documentation for this class was generated from the following file: