LibGfx: Implement copy-assign for Matrix

This used to generate a warning about using a deprecated copy-assign,
default-generated by the compiler, and deprecated because we hand-
implement the copy-constructor. This warning is correct, since the
default-generated copy-assign may or may not be as efficient as memcpy.

This patch gets rid of the warning, and has either no performance impact
or a slightly positive one. If this turns out to be wrong, we should
probably also fix the copy-constructor.
This commit is contained in:
Ben Wiederhake 2021-10-10 15:42:19 +02:00 committed by Linus Groh
parent fd8300e52d
commit ee18912373
Notes: sideshowbarker 2024-07-18 02:51:09 +09:00

View File

@ -38,6 +38,12 @@ public:
__builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N);
}
Matrix& operator=(const Matrix& other)
{
__builtin_memcpy(m_elements, other.elements(), sizeof(T) * N * N);
return *this;
}
constexpr auto elements() const { return m_elements; }
constexpr auto elements() { return m_elements; }