diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 91686d18e..ab42bed13 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -382,6 +382,7 @@ template class Vector { * @see @ref operator+=(), @ref sum() */ Vector operator+(const Vector& other) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) += other; } @@ -405,6 +406,7 @@ template class Vector { * @see @ref operator-=() */ Vector operator-(const Vector& other) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) -= other; } @@ -432,6 +434,7 @@ template class Vector { * @ref operator*(FloatingPoint) const */ Vector operator*(T scalar) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) *= scalar; } @@ -481,7 +484,8 @@ template class Vector { template typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif operator*(FloatingPoint scalar) const { - return Vector{*this} *= scalar; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) *= scalar; } /** @@ -522,6 +526,7 @@ template class Vector { * @ref operator/(FloatingPoint) const */ Vector operator/(T scalar) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) /= scalar; } @@ -579,7 +584,8 @@ template class Vector { template typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif operator/(FloatingPoint scalar) const { - return Vector{*this} /= scalar; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) /= scalar; } /** @@ -606,6 +612,7 @@ template class Vector { * @ref product() */ Vector operator*(const Vector& other) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) *= other; } @@ -641,7 +648,8 @@ template class Vector { , class Integral = T, typename std::enable_if::value && std::is_floating_point::value>::type* = nullptr #endif > Vector operator*(const Vector& other) const { - return Vector{*this} *= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) *= other; } /** @@ -685,6 +693,7 @@ template class Vector { * @ref operator/(const Vector&) const */ Vector operator/(const Vector& other) const { + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ return Vector(*this) /= other; } @@ -721,7 +730,8 @@ template class Vector { template typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif operator/(const Vector& other) const { - return Vector{*this} /= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) /= other; } /** @@ -752,7 +762,8 @@ template class Vector { template typename std::enable_if::value, Vector>::type #endif operator%(T scalar) const { - return Vector{*this} %= scalar; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) %= scalar; } /** @@ -783,7 +794,8 @@ template class Vector { template typename std::enable_if::value, Vector>::type #endif operator%(const Vector& other) const { - return Vector{*this} %= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) %= other; } /** @@ -833,7 +845,8 @@ template class Vector { template typename std::enable_if::value, Vector>::type #endif operator&(const Vector& other) const { - return Vector{*this} &= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) &= other; } /** @@ -864,7 +877,8 @@ template class Vector { template typename std::enable_if::value, Vector>::type #endif operator|(const Vector& other) const { - return Vector{*this} |= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) |= other; } /** @@ -895,7 +909,8 @@ template class Vector { template typename std::enable_if::value, Vector>::type #endif operator^(const Vector& other) const { - return Vector{*this} ^= other; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) ^= other; } /** @@ -927,7 +942,8 @@ template class Vector { operator<<(typename std::common_type::type shift) const #endif { - return Vector{*this} <<= shift; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) <<= shift; } /** @@ -959,7 +975,8 @@ template class Vector { typename std::enable_if::value, Vector>::type operator>>(typename std::common_type::type shift) const #endif { - return Vector{*this} >>= shift; + /* MSVC 2015 and 2017 treat the copy as a const if {} is used */ + return Vector(*this) >>= shift; } /**