Common/Rectangle: Use memcpy for operator=

This commit is contained in:
Connor McLaughlin 2020-10-22 19:31:11 +10:00
parent dc53209565
commit beffbaee39
1 changed files with 3 additions and 5 deletions

View File

@ -3,6 +3,7 @@
#include <limits>
#include <tuple>
#include <type_traits>
#include <cstring>
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
} // namespace Common