diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 0ce4d02e5..91686d18e 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -636,12 +636,11 @@ template class Vector { * an integral vector, convert both arguments to the same * floating-point type to have a floating-point result. */ - #ifdef DOXYGEN_GENERATING_OUTPUT - template Vector - #else - template typename std::enable_if::value && std::is_floating_point::value, Vector>::type - #endif - operator*(const Vector& other) const { + template::value && std::is_floating_point::value>::type* = nullptr + #endif + > Vector operator*(const Vector& other) const { return Vector{*this} *= other; } @@ -650,13 +649,17 @@ template class Vector { * * Same as @ref operator*(const Vector&) const. */ - #ifdef DOXYGEN_GENERATING_OUTPUT - template friend Vector - #else - template friend typename std::enable_if::value && std::is_floating_point::value, Vector>::type - #endif - operator*(const Vector& a, const Vector& b) { - return b*a; + /* This was originally friend operator*(const Vector&, const Vector&), + but that made it not found on MSVC 2015 and 2017 (and possibly + newer?) for some reason. Making it a member operator makes it work, + but it additionally has to prevent a conflict with the + Integral*FloatingPoint variant above */ + template::value && std::is_floating_point::value>::type* = nullptr + #endif + > Vector operator*(const Vector& other) const { + return other**this; } /** @@ -1329,11 +1332,11 @@ extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<4, Double>& Math::Vector::operator*=(other); \ return *this; \ } \ - template typename std::enable_if::value && std::is_floating_point::value, Type>::type operator*(const Math::Vector& other) const { \ + template::value && std::is_floating_point::value>::type* = nullptr> Type operator*(const Math::Vector& other) const { \ return Math::Vector::operator*(other); \ } \ - template friend typename std::enable_if::value && std::is_floating_point::value, Type>::type operator*(const Math::Vector& a, const Type& b) { \ - return a*static_cast&>(b); \ + template::value && std::is_floating_point::value>::type* = nullptr> Type operator*(const Math::Vector& other) const { \ + return Math::Vector::operator*(other); \ } \ \ Type& operator/=(const Math::Vector& other) { \