diff --git a/src/Magnum/Math/Unit.h b/src/Magnum/Math/Unit.h index 3c7d73448..5923d8f08 100644 --- a/src/Magnum/Math/Unit.h +++ b/src/Magnum/Math/Unit.h @@ -144,6 +144,22 @@ template class Derived, class T> class Unit { return Unit(_value*number); } + /** + * @brief Multiply a number with a value + * + * Same as @ref operator*(T) const. + */ + constexpr friend Unit operator*( + #ifdef DOXYGEN_GENERATING_OUTPUT + T + #else + typename std::common_type::type + #endif + number, Unit value) + { + return Unit{value._value*number}; + } + /** @brief Divide with a number and assign */ Unit& operator/=(T number) { _value /= number; @@ -164,13 +180,6 @@ template class Derived, class T> class Unit { T _value; }; -/** @relates Unit -@brief Multiply number with value -*/ -template class Derived, class T> constexpr Unit operator*(typename std::common_type::type number, const Unit& value) { - return value*number; -} - }} #endif