Interval template type.
More...
#include <Interval.hpp>
|
constexpr | Interval (pair_type pair) noexcept |
| Internal pair type accepting constructor.
|
|
template<typename T>
class playrho::Interval< T >
Interval template type.
This type encapsulates an interval as a min-max value range relationship.
- Invariant
- The min and max values can only be the result of
std::minmax(a, b)
or the special values of the "highest" and "lowest" values supported by the type for this class respectively indicating the "unset" value.
- See also
- https://en.wikipedia.org/wiki/Interval_(mathematics)
◆ pair_type
Internal pair type.
- Note
- Uses
std::pair
since it's the most natural type given that std::minmax
returns it.
◆ value_type
Value type.
Alias for the type of the value that this class was template instantiated for.
◆ Interval() [1/4]
◆ Interval() [2/4]
Copy constructor.
- Postcondition
GetMin()
returns the value of other.GetMin()
.
-
GetMax()
returns the value of other.GetMax()
.
◆ Interval() [3/4]
Move constructor.
- Postcondition
GetMin()
returns the value of other.GetMin()
.
-
GetMax()
returns the value of other.GetMax()
.
◆ Interval() [4/4]
template<typename T >
|
inlineexplicitconstexprnoexcept |
Initializing constructor.
- Postcondition
GetMin()
returns the value of v
.
-
GetMax()
returns the value of v
.
◆ Expand()
Expands this interval.
Expands this interval by decreasing the min value if the given value is negative, or by increasing the max value if the given value is positive.
- Parameters
-
v | Amount to expand this interval by. |
- Warning
- Behavior is undefined if expanding the range by the given amount overflows the range of the
value_type
,
◆ ExpandEqually()
Expands equally both ends of this interval.
Expands equally this interval by decreasing the min value and by increasing the max value by the given amount.
- Note
- This operation has no effect if this interval is "unset".
- Parameters
-
v | Amount to expand both ends of this interval by. |
- Warning
- Behavior is undefined if expanding the range by the given amount overflows the range of the
value_type
,
◆ GetHighest()
template<typename T >
|
inlinestaticconstexprnoexcept |
Gets the "highest" value supported by the value_type
.
- Returns
- Positive infinity if supported by the value type, limits::max() otherwise.
◆ GetLowest()
template<typename T >
|
inlinestaticconstexprnoexcept |
Gets the "lowest" value supported by the value_type
.
- Returns
- Negative infinity if supported by the value type, limits::lowest() otherwise.
◆ Include() [1/2]
Includes the given interval into this interval.
- Note
- If this value is the "unset" value then the result of this operation will be the given value.
- Parameters
-
v | Value to "include" into this value. |
- Postcondition
- This value's "min" is the minimum of the given value's "min" and this value's "min".
◆ Include() [2/2]
Includes the given value into this interval.
- Note
- If this value is the "unset" value then the result of this operation will be the given value.
- Parameters
-
v | Value to "include" into this value. |
- Postcondition
- This value's "min" is the minimum of the given value and this value's "min".
◆ Move()
Moves the interval by the given amount.
- Warning
- Behavior is undefined if incrementing the min or max value by the given amount overflows the finite range of the
value_type
,
◆ operator=() [1/2]
Copy assignment operator.
- Postcondition
GetMin()
returns the value of other.GetMin()
.
-
GetMax()
returns the value of other.GetMax()
.
◆ operator=() [2/2]
Move assignment operator.
- Postcondition
GetMin()
returns the value of other.GetMin()
.
-
GetMax()
returns the value of other.GetMax()
.
◆ GetCenter()
template<typename T >
constexpr T GetCenter |
( |
const Interval< T > & |
v | ) |
|
|
related |
Gets the center of the given interval.
- Warning
- Behavior is undefined if the difference between the given range's max and min values overflows the range of the
Interval::value_type
.
◆ operator!=()
◆ operator<()
template<typename T >
constexpr bool operator< |
( |
const Interval< T > & |
lhs, |
|
|
const Interval< T > & |
rhs |
|
) |
| |
|
related |
◆ operator<=()
template<typename T >
constexpr bool operator<= |
( |
const Interval< T > & |
lhs, |
|
|
const Interval< T > & |
rhs |
|
) |
| |
|
related |
◆ operator==()
◆ operator>()
template<typename T >
constexpr bool operator> |
( |
const Interval< T > & |
lhs, |
|
|
const Interval< T > & |
rhs |
|
) |
| |
|
related |
◆ operator>=()
template<typename T >
constexpr bool operator>= |
( |
const Interval< T > & |
lhs, |
|
|
const Interval< T > & |
rhs |
|
) |
| |
|
related |
The documentation for this class was generated from the following files:
- Interval.hpp
- Intervals.hpp