diff --git a/Utilities/geometry.h b/Utilities/geometry.h index e37ab7ed16..ee8aeb2332 100644 --- a/Utilities/geometry.h +++ b/Utilities/geometry.h @@ -1,6 +1,7 @@ #pragma once #include +#include template struct size2_base @@ -670,17 +671,22 @@ struct area_base { return{ x1 / size.width, y1 / size.height, x2 / size.width, y2 / size.height }; } - constexpr area_base operator / (const T& value) const + + template requires (std::is_arithmetic_v) + constexpr area_base operator / (const U& value) const { - return{ x1 / value, y1 / value, x2 / value, y2 / value }; + return area_base{static_cast(x1 / value), static_cast(y1 / value), static_cast(x2 / value), static_cast(y2 / value)}; } + constexpr area_base operator * (const size2_base& size) const { return{ x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height }; } - constexpr area_base operator * (const f32& value) const + + template requires (std::is_arithmetic_v) + constexpr area_base operator * (const U& value) const { - return{ static_cast(x1 * value), static_cast(y1 * value), static_cast(x2 * value), static_cast(y2 * value) }; + return area_base{static_cast(x1 * value), static_cast(y1 * value), static_cast(x2 * value), static_cast(y2 * value)}; } template