From a42d025ffb8069e42cd090dd13a87b9664465370 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Sun, 14 Sep 2025 00:02:19 +0300 Subject: [PATCH] libs/math fixes in case scalar type isn't implicitly constructible from int --- libs/math/include/psemek/math/interval.hpp | 2 +- libs/math/include/psemek/math/matrix.hpp | 4 ++-- libs/math/include/psemek/math/point.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/math/include/psemek/math/interval.hpp b/libs/math/include/psemek/math/interval.hpp index d2a55d4e..80542481 100644 --- a/libs/math/include/psemek/math/interval.hpp +++ b/libs/math/include/psemek/math/interval.hpp @@ -98,7 +98,7 @@ namespace psemek::math T center() const { - return min + (max - min) / 2; + return min + (max - min) / T(2); } using iterator = interval_iterator; diff --git a/libs/math/include/psemek/math/matrix.hpp b/libs/math/include/psemek/math/matrix.hpp index eabfd12f..d3f81f6c 100644 --- a/libs/math/include/psemek/math/matrix.hpp +++ b/libs/math/include/psemek/math/matrix.hpp @@ -57,14 +57,14 @@ namespace psemek::math { matrix m; for (std::size_t i = 0; i < R * C; ++i) - m.coords[i] = 0; + m.coords[i] = T(0); return m; } template matrix matrix::identity() { - return scalar(T{1}); + return scalar(T(1)); } template diff --git a/libs/math/include/psemek/math/point.hpp b/libs/math/include/psemek/math/point.hpp index 7cb5d2bf..8b05a67d 100644 --- a/libs/math/include/psemek/math/point.hpp +++ b/libs/math/include/psemek/math/point.hpp @@ -56,7 +56,7 @@ namespace psemek::math { point p; for (std::size_t i = 0; i < N; ++i) - p[i] = 0; + p[i] = T(0); return p; }