mathlib : switch min/max to constexpr to match std::min/max

This commit is contained in:
Mohammed Kabir 2017-04-22 15:24:29 +02:00 committed by Kabir Mohammed
parent 9909a373b0
commit c8dad56300
1 changed files with 3 additions and 3 deletions

View File

@ -56,19 +56,19 @@ namespace math
{
template<typename _Tp>
inline const _Tp &min(const _Tp &a, const _Tp &b)
inline constexpr const _Tp &min(const _Tp &a, const _Tp &b)
{
return (a < b) ? a : b;
}
template<typename _Tp>
inline const _Tp &max(const _Tp &a, const _Tp &b)
inline constexpr const _Tp &max(const _Tp &a, const _Tp &b)
{
return (a > b) ? a : b;
}
template<typename _Tp>
inline const _Tp &constrain(const _Tp &val, const _Tp &min_val, const _Tp &max_val)
inline constexpr const _Tp &constrain(const _Tp &val, const _Tp &min_val, const _Tp &max_val)
{
return (val < min_val) ? min_val : ((val > max_val) ? max_val : val);
}