diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h index a055e6926..b9c3d41ef 100644 --- a/include/libcamera/internal/matrix.h +++ b/include/libcamera/internal/matrix.h @@ -19,14 +19,11 @@ namespace libcamera { LOG_DECLARE_CATEGORY(Matrix) -#ifndef __DOXYGEN__ -template> * = nullptr> -#else template -#endif /* __DOXYGEN__ */ class Matrix { + static_assert(std::is_arithmetic_v, "Matrix type must be arithmetic"); + public: Matrix() { @@ -123,16 +120,10 @@ Matrix operator*(const Matrix &m, T d) return d * m; } -#ifndef __DOXYGEN__ -template * = nullptr> -#else -template -#endif /* __DOXYGEN__ */ -Matrix operator*(const Matrix &m1, const Matrix &m2) +template +constexpr Matrix operator*(const Matrix &m1, const Matrix &m2) { + static_assert(C1 == R2, "Matrix dimensions must match for multiplication"); Matrix result; for (unsigned int i = 0; i < R1; i++) {