maths: add limit function for min/max'ing
This commit is contained in:
parent
5e1aad2f15
commit
2eaf2ee73c
@ -175,6 +175,14 @@ template <typename T>
|
|||||||
int sign (T val);
|
int sign (T val);
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T, typename U, typename V>
|
||||||
|
T
|
||||||
|
limit (const T &&val, const U &&hi, const V &&lo) {
|
||||||
|
return val > hi ? hi:
|
||||||
|
val < lo ? lo:
|
||||||
|
std::move (val);
|
||||||
|
}
|
||||||
|
|
||||||
#include "maths.ipp"
|
#include "maths.ipp"
|
||||||
|
|
||||||
#endif // __MATHS_HPP
|
#endif // __MATHS_HPP
|
||||||
|
Loading…
Reference in New Issue
Block a user