|
template<typename T, typename R> |
const T & | pin (const T &min, const T &x, const T &max, R r) |
| pin implementation
|
template<typename T> |
const T & | pin (const T &min, const T &x, const T &max) |
| pin implementation
|
template<typename T, typename R> |
const T & | pin_safe (const T &min, const T &x, const T &max, R r) |
| pin_safe implementation
|
template<typename T, typename R> |
const T & | pin_safe (const T &min, const T &x, const T &max) |
| pin_safe implementation
|
- Deprecated
- The
pin()
and pin_unsafe()
functions have been deprecated in favor of clamp()
and clamp_unordered()
. Note that the parameter order is different.
If x
is outside the range (min, max)
then the closest of either min
or max
is returned. If x
is within the range specified then x
is returned.
- Precondition
min <= max
- Postcondition
min <= result <= max
pin_safe is similar to pin but should be used when you are not sure which bound is the minimum and which is the maximum. It is 'safe' in that, at the cost of an extra comparison, will assert the min and max bounds are placed where they should be when the actual pin is executed.
◆ pin() [1/2]
template<typename T, typename R>
const T & pin |
( |
const T & | min, |
|
|
const T & | x, |
|
|
const T & | max, |
|
|
R | r ) |
◆ pin() [2/2]
template<typename T>
const T & pin |
( |
const T & | min, |
|
|
const T & | x, |
|
|
const T & | max ) |
◆ pin_safe() [1/2]
template<typename T, typename R>
const T & pin_safe |
( |
const T & | min, |
|
|
const T & | x, |
|
|
const T & | max, |
|
|
R | r ) |
◆ pin_safe() [2/2]
template<typename T, typename R>
const T & pin_safe |
( |
const T & | min, |
|
|
const T & | x, |
|
|
const T & | max ) |