From 4ef674f7b46dcbc5bfc8660ad2ad2bb82d91c7d1 Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 29 Apr 2025 20:08:27 +0300 Subject: [PATCH] fixed infinite recursion in compile time --- include/omath/mat.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/omath/mat.hpp b/include/omath/mat.hpp index 47773c6..07ae913 100644 --- a/include/omath/mat.hpp +++ b/include/omath/mat.hpp @@ -253,7 +253,8 @@ namespace omath if constexpr (Rows == 2) return At(0, 0) * At(1, 1) - At(0, 1) * At(1, 0); - else + + if constexpr (Rows > 2) { Type det = 0; for (size_t i = 0; i < Columns; ++i) @@ -263,11 +264,13 @@ namespace omath } return det; } + std::unreachable(); } [[nodiscard]] constexpr Mat Minor(const size_t row, const size_t column) const { + static_assert(Rows-1 > 0 && Columns-1 > 0); Mat result; for (size_t i = 0, m = 0; i < Rows; ++i) {