maths: add limit function for min/max'ing

This commit is contained in:
Danny Robson 2014-08-02 21:13:51 +10:00
parent 5e1aad2f15
commit 2eaf2ee73c

View File

@ -175,6 +175,14 @@ template <typename T>
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"
#endif // __MATHS_HPP