42 static_assert(std::is_arithmetic<T>::value,
"Template argument of Interval must be arithmetic.");
60 if (minimum > maximum)
118 typename std::enable_if_t<std::is_integral<H>::value,
int> = 0
140 typename std::enable_if_t<std::is_floating_point<H>::value,
int> = 0
146 constexpr uint32_t ulp = 4;
148 using common_type = std::common_type_t<H, T>;
163 return !(rhs == *
this);
176 return os <<
"{ minimum: " << interval.m_minimum <<
", maximum: " << interval.m_maximum <<
" }";
187 std::ostringstream ss;
196 friend detail::BackendAccessor<IntervalT<T>>;
198 template <
typename U = T,
typename std::enable_if<has_c_type_of<IntervalT<U>>::value,
bool>::type = false>
200 :
IntervalT<U>(interval.minimum, interval.maximum)
203 template <
typename U = T,
typename std::enable_if<has_c_type_of<IntervalT<U>>::value,
bool>::type = false>
204 constexpr explicit operator detail::c_type_of_t<IntervalT<U>>()
const
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:53
Represents a continuous numeric interval with inclusive lower and upper bounds.
Definition peak_common_interval.hpp:39
friend std::ostream & operator<<(std::ostream &os, IntervalT interval)
Outputs the interval as a human-readable string to a stream.
Definition peak_common_interval.hpp:174
constexpr IntervalT(T minimum, T maximum)
Constructs an interval with the given lower and upper bounds.
Definition peak_common_interval.hpp:56
PEAK_COMMON_NO_DISCARD constexpr T GetMaximum() const
Returns the upper boundary of the interval.
Definition peak_common_interval.hpp:83
PEAK_COMMON_NO_DISCARD std::string ToString() const
Returns a string representation of the interval.
Definition peak_common_interval.hpp:185
constexpr bool operator==(const IntervalT< H > &rhs) const
Compares two intervals for equality (integral types).
Definition peak_common_interval.hpp:121
T type
Definition peak_common_interval.hpp:44
PEAK_COMMON_NO_DISCARD constexpr T Clamp(T value) const
Clamps a value to the bounds of this interval.
Definition peak_common_interval.hpp:100
constexpr bool operator!=(const IntervalT &rhs) const
Inequality comparison operator.
Definition peak_common_interval.hpp:161
PEAK_COMMON_NO_DISCARD constexpr T GetMinimum() const
Returns the lower boundary of the interval.
Definition peak_common_interval.hpp:72
constexpr bool AreAlmostEqual(H lhs, H rhs, uint32_t ulp)
Compares two floating-point values for approximate equality using a ULP-based tolerance.
Definition peak_common_math.hpp:45
detail::IntervalT< float > IntervalF
Interval with floating-point boundaries.
Definition peak_common_interval.hpp:274
detail::IntervalT< int32_t > Interval
Interval with signed 32-bit integer boundaries.
Definition peak_common_interval.hpp:242
detail::IntervalT< double > IntervalD
Interval with double-precision floating-point boundaries.
Definition peak_common_interval.hpp:291
detail::IntervalT< int64_t > Interval64
Interval with signed 64-bit integer boundaries.
Definition peak_common_interval.hpp:258
detail::IntervalT< uint32_t > IntervalU
Interval with unsigned 32-bit integer boundaries.
Definition peak_common_interval.hpp:226
Namespace for internal implementation details and low-level types.
Definition peak_common_math.hpp:19
constexpr T Clamp(T value, T minimum, T maximum)
Definition peak_common_math.hpp:51
Root namespace for common types and interfaces shared across multiple libraries.
Definition peak_common_math.hpp:17
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_buffer.hpp:29
#define PEAK_COMMON_NO_DISCARD
Definition peak_common_defines.h:89