29 #ifndef NVXIO_RANGE_HPP
30 #define NVXIO_RANGE_HPP
87 return low != std::numeric_limits<T>::lowest() || !lowInclusive;
93 return high != std::numeric_limits<T>::max() || !highInclusive;
99 bool lowOk = lowInclusive ? x >= low : x > low;
100 bool highOk = highInclusive ? x <= high : x < high;
101 return lowOk && highOk;
111 template <
typename T>
162 template <
typename T>
164 return { std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max(),
true,
true };
173 template <
typename T>
175 return { std::numeric_limits<T>::lowest(), x,
true,
false };
184 template <
typename T>
186 return { x, std::numeric_limits<T>::max(),
false,
true };
195 template <
typename T>
197 return { x, std::numeric_limits<T>::max(),
true,
true };
206 template <
typename T>
208 return { std::numeric_limits<T>::lowest(), x,
true,
true };
215 #endif // NVXIO_RANGE_HPP
Range< T > atMost(T x)
Creates a range that includes the values that are less than or equal to the particular number (values...
bool highConstrained() const
Determines if the range is right-bounded.
bool lowConstrained() const
Determines if the range is left-bounded.
Range< T > all()
Creates a range that includes all points.
Range< T > operator&(const Range< T > &r1, const Range< T > &r2)
Calculates intersection of the two ranges.
Range< T > moreThan(T x)
Creates a range that includes the values that are greater than the particular number (values > x)...
Range< T > lessThan(T x)
Creates a range that includes the values that are less than the particular number (values < x)...
bool highInclusive
Holds the flag that determines if the range includes the right bound.
Range< T > atLeast(T x)
Creates a range that includes the values that are greater than or equal to the particular number (val...
bool contains(T x) const
Determines if the range includes the particular point.
T low
Holds the left bound of the range.
T high
Holds the right bound of the range.
bool lowInclusive
Holds the flag that determines if the range includes the left bound.