38template <
typename ValueType>
75 return Range (start, start);
203 const auto tie = [] (
const Range& r) {
return std::tie (r.start, r.end); };
204 return tie (*
this) == tie (other);
207 constexpr bool operator!= (
Range other)
const noexcept {
return ! operator== (other); }
216 return start <= position && position < end;
222 return jlimit (start, end, value);
228 return start <= other.start && end >= other.end;
234 return other.start < end && start < other.end;
241 return Range (jmax (start, other.start),
242 jmin (end, other.end));
248 return Range (jmin (start, other.start),
249 jmax (end, other.end));
278 template <
typename Integral, std::enable_if_t<std::is_
integral_v<Integral>,
int> = 0>
285 Range r (first, first);
291 if (r.end < v) r.end = v;
292 if (v < r.start) r.start = v;
static Range withStartAndLength(const ValueType startValue, const ValueType length) noexcept
void setEnd(const ValueType newEnd) noexcept
constexpr Range expanded(ValueType amount) const noexcept
Range constrainRange(Range rangeToConstrain) const noexcept
constexpr ValueType getStart() const noexcept
constexpr Range operator-(const ValueType amountToSubtract) const noexcept
constexpr bool contains(Range other) const noexcept
constexpr bool isEmpty() const noexcept
constexpr Range getIntersectionWith(Range other) const noexcept
static constexpr Range emptyRange(const ValueType start) noexcept
constexpr bool intersects(Range other) const noexcept
constexpr ValueType getEnd() const noexcept
constexpr Range operator+(const ValueType amountToAdd) const noexcept
constexpr Range withEnd(const ValueType newEnd) const noexcept
constexpr Range(const ValueType startValue, const ValueType endValue) noexcept
constexpr Range(const Range &)=default
constexpr Range getUnionWith(Range other) const noexcept
static Range findMinAndMax(const ValueType *values, Integral numValues) noexcept
ValueType clipValue(const ValueType value) const noexcept
static constexpr Range between(const ValueType position1, const ValueType position2) noexcept
constexpr Range movedToStartAt(const ValueType newStart) const noexcept
constexpr Range withLength(const ValueType newLength) const noexcept
constexpr Range getUnionWith(const ValueType valueToInclude) const noexcept
Range operator+=(const ValueType amountToAdd) noexcept
void setLength(const ValueType newLength) noexcept
void setStart(const ValueType newStart) noexcept
constexpr ValueType getLength() const noexcept
Range & operator=(const Range &)=default
constexpr bool contains(const ValueType position) const noexcept
Range operator-=(const ValueType amountToSubtract) noexcept
constexpr Range()=default
constexpr Range withStart(const ValueType newStart) const noexcept
constexpr Range movedToEndAt(const ValueType newEnd) const noexcept