1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibGfx: Mark some Matrix functions as [[nodiscard]]

This commit is contained in:
Jelle Raaijmakers 2021-12-30 07:42:16 +01:00 committed by Andreas Kling
parent 57e1dc7765
commit e056cf7e3f

View file

@ -92,7 +92,7 @@ public:
return division;
}
constexpr Matrix adjugate() const
[[nodiscard]] constexpr Matrix adjugate() const
{
if constexpr (N == 1)
return Matrix(1);
@ -107,7 +107,7 @@ public:
return adjugate;
}
constexpr T determinant() const
[[nodiscard]] constexpr T determinant() const
{
if constexpr (N == 1) {
return m_elements[0][0];
@ -122,7 +122,7 @@ public:
}
}
constexpr T first_minor(size_t skip_row, size_t skip_column) const
[[nodiscard]] constexpr T first_minor(size_t skip_row, size_t skip_column) const
{
static_assert(N > 1);
VERIFY(skip_row < N);
@ -145,7 +145,7 @@ public:
return first_minor.determinant();
}
constexpr static Matrix identity()
[[nodiscard]] constexpr static Matrix identity()
{
Matrix result;
for (size_t i = 0; i < N; ++i) {
@ -159,14 +159,14 @@ public:
return result;
}
constexpr Matrix inverse() const
[[nodiscard]] constexpr Matrix inverse() const
{
auto det = determinant();
VERIFY(det != 0);
return adjugate() / det;
}
constexpr Matrix transpose() const
[[nodiscard]] constexpr Matrix transpose() const
{
Matrix result;
for (size_t i = 0; i < N; ++i) {