improved naming

This commit is contained in:
2025-04-11 23:30:07 +03:00
parent 466d8f7bec
commit 1b47f45af9

View File

@@ -175,9 +175,7 @@ namespace omath
constexpr Mat& operator*=(const Type& f) noexcept constexpr Mat& operator*=(const Type& f) noexcept
{ {
for (size_t i = 0; i < Rows; ++i) std::ranges::for_each(m_data,[&f](auto& val) {val *= f;});
for (size_t j = 0; j < Columns; ++j)
At(i, j) *= f;
return *this; return *this;
} }
@@ -189,45 +187,39 @@ namespace omath
} }
[[nodiscard]] [[nodiscard]]
constexpr Mat operator*(const Type& f) const noexcept constexpr Mat operator*(const Type& value) const noexcept
{ {
Mat result(*this); Mat result(*this);
result *= f; result *= value;
return result; return result;
} }
constexpr Mat& operator/=(const Type& f) noexcept constexpr Mat& operator/=(const Type& value) noexcept
{ {
std::ranges::for_each(m_data,[&f](auto& val) {val /= f;}); std::ranges::for_each(m_data,[&value](auto& val) {val /= value;});
return *this; return *this;
} }
[[nodiscard]] [[nodiscard]]
constexpr Mat operator/(const Type& f) const noexcept constexpr Mat operator/(const Type& value) const noexcept
{ {
Mat result(*this); Mat result(*this);
result /= f; result /= value;
return result; return result;
} }
constexpr Mat& operator=(const Mat& other) noexcept constexpr Mat& operator=(const Mat& other) noexcept
{ {
if (this == &other) if (this != &other)
return *this; m_data = other.m_data;
for (size_t i = 0; i < Rows; ++i)
for (size_t j = 0; j < Columns; ++j)
At(i, j) = other.At(i, j);
return *this; return *this;
} }
constexpr Mat& operator=(Mat&& other) noexcept constexpr Mat& operator=(Mat&& other) noexcept
{ {
if (this == &other) if (this != &other)
return *this; m_data = std::move(other.m_data);
for (size_t i = 0; i < Rows; ++i)
for (size_t j = 0; j < Columns; ++j)
At(i, j) = other.At(i, j);
return *this; return *this;
} }