49 if (
other.empty())
return *
this;
56 if constexpr (std::is_integral_v<T>) {
57 return std::clamp(value,
start,
end - T(1));
65 if (
empty())
return Range(value, value + T(1));
66 return Range(std::min(
start, value), std::max(
end, value + T(1)));
Definition generated_event_source.hpp:33
Range< double > DoubleRange
Definition range.hpp:81
Range< float > FloatRange
Definition range.hpp:80
Range< size_t > SizeRange
Definition range.hpp:82
Range< int > IntRange
Definition range.hpp:79
@ other
Definition udev_monitor.hpp:26
constexpr bool empty() const
Whether the range is empty (start >= end).
Definition range.hpp:24
constexpr Range(T s, T e)
Definition range.hpp:18
int end
Definition range.hpp:15
constexpr T length() const
Length of the range.
Definition range.hpp:21
int start
Definition range.hpp:14
constexpr Range enclosing_union(const Range &other) const
Union of two ranges (bounding box — may include a gap).
Definition range.hpp:47
constexpr Range expanded(T value) const
Expand range to include a value.
Definition range.hpp:64
constexpr bool contains(const Range &other) const
Whether this range fully contains another range.
Definition range.hpp:30
constexpr Range intersection(const Range &other) const
Intersection of two ranges (empty if no overlap).
Definition range.hpp:40
constexpr T constrain(T value) const
Constrain a value to this range [start, end).
Definition range.hpp:54
constexpr bool contains(T value) const
Whether this range contains a value.
Definition range.hpp:27
constexpr Range()=default
static constexpr Range from_start_length(T s, T len)
Create a range from start + length.
Definition range.hpp:75
constexpr bool intersects(const Range &other) const
Whether this range intersects another range.
Definition range.hpp:35
constexpr bool operator==(const Range &other) const
Definition range.hpp:69
constexpr bool operator!=(const Range &other) const
Definition range.hpp:72