diff --git a/src/Magnum/Math/Functions.h b/src/Magnum/Math/Functions.h index 6e70e1fdf..897e077cb 100644 --- a/src/Magnum/Math/Functions.h +++ b/src/Magnum/Math/Functions.h @@ -55,6 +55,17 @@ namespace Implementation { template struct IsBoolVector: std::false_type {}; template struct IsBoolVector>: std::true_type {}; + + template struct IsVectorOrScalar: std::is_arithmetic::type {}; + template class Derived, class T> struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; + template struct IsVectorOrScalar>: std::true_type {}; } /** @@ -549,16 +560,15 @@ See @ref select() for constant interpolation using the same API. @see @ref lerpInverted(), @ref lerp(const Quaternion&, const Quaternion&, T) @m_keyword{mix(),GLSL mix(),} */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template inline T lerp(const T& a, const T& b, U t); -#else -template inline typename std::enable_if::value, T>::type lerp(T a, T b, U t) { - return T(Implementation::lerp(a, b, t)); -} -template inline typename std::enable_if::value, Vector>::type lerp(const Vector& a, const Vector& b, U t) { +template inline + #ifndef DOXYGEN_GENERATING_OUTPUT + typename std::enable_if::value && !Implementation::IsBoolVector::value, T>::type + #else + T + #endif +lerp(const T& a, const T& b, U t) { return Implementation::lerp(a, b, t); } -#endif /** @overload Similar to the above, but instead of multiplication and addition it just does