15#include <peak_common_c/detail/peak_common_defines.h>
47 static_assert(std::is_arithmetic<T>::value,
"Template argument of Interval must be arithmetic.");
63 constexpr RangeT(T minimum, T maximum, T increment)
65 , m_increment{ increment }
67 if (increment > maximum - minimum)
110 return !(rhs == *
this);
133 PEAK_COMMON_NO_DISCARD std::string
ToString()
const
135 std::ostringstream ss;
143 friend detail::BackendAccessor<RangeT<T>>;
145 template <
typename U = T,
typename std::enable_if<has_c_type_of<RangeT<U>>::value,
bool>::type = false>
147 :
RangeT<U>(range.minimum, range.maximum, range.increment)
150 template <
typename U = T,
typename std::enable_if<has_c_type_of<RangeT<U>>::value,
bool>::type = false>
Thrown when a function receives an invalid parameter.
Represents a continuous numeric interval with inclusive lower and upper bounds.
constexpr T GetMinimum() const
Returns the lower boundary of the interval.
constexpr bool operator==(const IntervalT< H > &rhs) const
Compares two intervals for equality (integral types).
constexpr T GetMaximum() const
Returns the upper boundary of the interval.
Represents a numeric range with defined boundaries and a fixed increment.
std::string ToString() const
Returns a string representation of the range.
constexpr bool operator==(const RangeT &rhs) const
Compares this range with another for equality.
constexpr T GetIncrement() const
Retrieves the increment value associated with this range.
constexpr RangeT(T minimum, T maximum, T increment)
Constructs a range with specified minimum, maximum, and increment values.
friend std::ostream & operator<<(std::ostream &os, RangeT range)
Outputs the range as a human-readable string to a stream.
constexpr bool operator!=(const RangeT &rhs) const
Compares this range with another for inequality.
typename c_type_of_< Type >::type c_type_of_t