diff --git a/src/Magnum/Math/Functions.h b/src/Magnum/Math/Functions.h index db45dc55b..be66b12d0 100644 --- a/src/Magnum/Math/Functions.h +++ b/src/Magnum/Math/Functions.h @@ -318,9 +318,8 @@ set to @p max. Equivalent to: NaNs passed in @p value parameter are propagated. @see @ref min(), @ref max() */ -template inline typename std::enable_if::value, T>::type clamp(T value, T min, T max) { - return Math::min(Math::max(value, min), max); -} +/* defined in Vector.h */ +template constexpr typename std::enable_if::value, T>::type clamp(T value, T min, T max); /** @overload */ template inline Vector clamp(const Vector& value, const Vector& min, const Vector& max) { diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 6a0ffc8f2..2ed8aa18d 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -56,6 +56,9 @@ template constexpr typename std::enable_if::value, T>::type template constexpr typename std::enable_if::value, T>::type max(T value, T max) { return value < max ? max : value; } +template constexpr typename std::enable_if::value, T>::type clamp(T value, T min, T max) { + return Math::min(Math::max(value, min), max); +} #endif namespace Implementation {