mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
LibGfx: Add [[nodiscard]]
to Matrix operators
This commit is contained in:
parent
3d532571bb
commit
6b167c8427
1 changed files with 5 additions and 5 deletions
|
@ -50,7 +50,7 @@ public:
|
||||||
constexpr auto elements() const { return m_elements; }
|
constexpr auto elements() const { return m_elements; }
|
||||||
constexpr auto elements() { return m_elements; }
|
constexpr auto elements() { return m_elements; }
|
||||||
|
|
||||||
constexpr Matrix operator*(Matrix const& other) const
|
[[nodiscard]] constexpr Matrix operator*(Matrix const& other) const
|
||||||
{
|
{
|
||||||
Matrix product;
|
Matrix product;
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Matrix operator+(Matrix const& other) const
|
[[nodiscard]] constexpr Matrix operator+(Matrix const& other) const
|
||||||
{
|
{
|
||||||
Matrix sum;
|
Matrix sum;
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
@ -94,7 +94,7 @@ public:
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Matrix operator/(T divisor) const
|
[[nodiscard]] constexpr Matrix operator/(T divisor) const
|
||||||
{
|
{
|
||||||
Matrix division;
|
Matrix division;
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
return division;
|
return division;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr Matrix operator*(Matrix const& matrix, T scalar)
|
[[nodiscard]] friend constexpr Matrix operator*(Matrix const& matrix, T scalar)
|
||||||
{
|
{
|
||||||
Matrix scaled;
|
Matrix scaled;
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
return scaled;
|
return scaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend constexpr Matrix operator*(T scalar, Matrix const& matrix)
|
[[nodiscard]] friend constexpr Matrix operator*(T scalar, Matrix const& matrix)
|
||||||
{
|
{
|
||||||
return matrix * scalar;
|
return matrix * scalar;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue