From 838e2b85e6dda883d3fce3da0562867705547683 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 22 Oct 2020 19:31:11 +1000 Subject: [PATCH] Common/Rectangle: Use memcpy for operator= --- src/common/rectangle.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/rectangle.h b/src/common/rectangle.h index c7369e57e..bd2689569 100644 --- a/src/common/rectangle.h +++ b/src/common/rectangle.h @@ -3,6 +3,7 @@ #include #include #include +#include namespace Common { @@ -63,10 +64,7 @@ struct Rectangle /// Assignment operator. constexpr Rectangle& operator=(const Rectangle& rhs) { - left = rhs.left; - top = rhs.top; - right = rhs.right; - bottom = rhs.bottom; + std::memcpy(this, &rhs, sizeof(Rectangle)); return *this; } @@ -193,4 +191,4 @@ struct Rectangle T bottom; }; -} // namespace Common \ No newline at end of file +} // namespace Common