diff --git a/Source/Engine/Core/Collections/Array.h b/Source/Engine/Core/Collections/Array.h index cf45ed060..a8390f051 100644 --- a/Source/Engine/Core/Collections/Array.h +++ b/Source/Engine/Core/Collections/Array.h @@ -734,9 +734,7 @@ public: } else { - Array tmp = MoveTemp(other); - other = *this; - *this = MoveTemp(tmp); + ::Swap(other, *this); } } diff --git a/Source/Engine/Core/Collections/Dictionary.h b/Source/Engine/Core/Collections/Dictionary.h index dd73be390..d2a840fff 100644 --- a/Source/Engine/Core/Collections/Dictionary.h +++ b/Source/Engine/Core/Collections/Dictionary.h @@ -616,9 +616,7 @@ public: } else { - Dictionary tmp = MoveTemp(other); - other = *this; - *this = MoveTemp(tmp); + ::Swap(other, *this); } } diff --git a/Source/Engine/Core/Templates.h b/Source/Engine/Core/Templates.h index 75674e2d0..876a4db83 100644 --- a/Source/Engine/Core/Templates.h +++ b/Source/Engine/Core/Templates.h @@ -304,7 +304,7 @@ template inline void Swap(T& a, T& b) noexcept { T tmp = MoveTemp(a); - a = b; + a = MoveTemp(b); b = MoveTemp(tmp); }