Range.hpp
A simple way to track value ranges.
Note
Status: BETA
Functions
-
template<typename T, bool INCLUDE_UPPER = true>
Range<T, INCLUDE_UPPER> MakeRange(T _l, T _u) Build a new range with auto-detected type.
-
template<bool INCLUDE_UPPER = true>
inline Range<int, INCLUDE_UPPER> IntRange(int _l, int _u) Build a new range of type int.
-
template<bool INCLUDE_UPPER = true>
inline Range<double, INCLUDE_UPPER> DRange(double _l, double _u) Build a new range of type double.
-
template<typename T, bool INCLUDE_UPPER = true>
class Range - #include <Range.hpp>
A range of values from a lower limit to and upper limit, of any provided type.
Public Functions
-
Range() = default
-
inline void SetMinLower()
-
inline void SetMaxUpper()
-
inline bool Has(T value) const
Determine if a provided value is in the range INCLUSIVE of the endpoints.
-
inline bool IsConnected(this_t in) const
Will identify if two ranges are next to each other or overlapping.
-
inline bool HasOverlap(this_t in) const
Determine if there is overlap between two range. Similar to IsConnected, but cannot be merely adjacent.
-
inline bool Expand(T val)
Expand this range to encompass a provided value.
- Parameters:
val – Value to expand through.
- Returns:
Whether the range has changed due to this expansion.
-
template<typename ...Ts>
inline bool Expand(T val1, T val2, Ts... args) Expand this range to encompass all provided values.
- Returns:
Whether the range has changed due to this expansion.
Private Types
-
using this_t = Range<T, INCLUDE_UPPER>
-
Range() = default