[ARITHMETIC OP][IMPLEMENTATION] rectifie dthe implementation of the unary - operator

This commit is contained in:
kallore 2025-05-19 16:59:10 +02:00
parent ee3197a0a6
commit 721550d0f8
3 changed files with 6 additions and 5 deletions

View file

@ -44,7 +44,7 @@ namespace rotgen
matrix_impl64& operator+=(matrix_impl64 const& rhs);
matrix_impl64& operator-=(matrix_impl64 const& rhs);
matrix_impl64& operator-();
matrix_impl64 operator-() const;
matrix_impl64& operator*=(matrix_impl64 const& rhs);
matrix_impl64& operator*=(double d);
matrix_impl64& operator/=(double d);

View file

@ -29,6 +29,8 @@ namespace rotgen
if constexpr(Cols != -1) assert(c == Cols && "Mismatched between dynamic and static column size");
}
matrix(parent const& base) : parent(base) {}
matrix(std::initializer_list<std::initializer_list<Scalar>> init) : parent(init)
{
if constexpr(Rows != -1) assert(init.size() == Rows && "Mismatched between dynamic and static row size");
@ -75,9 +77,9 @@ namespace rotgen
return *this;
}
matrix& operator-()
matrix operator-() const
{
return static_cast<parent const&>(*this).operator-();
return matrix(static_cast<parent const&>(*this).operator-());
}
matrix& operator*=(matrix const& rhs)