refactor(*): replace the old with the new iterator and range library
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreTypes.h"
|
||||
#include "TypeTraits/CompositeType.h"
|
||||
#include "TypeTraits/Common.h"
|
||||
#include "TypeTraits/Miscellaneous.h"
|
||||
#include "TypeTraits/SupportedOperations.h"
|
||||
|
||||
@ -73,6 +73,17 @@ FORCEINLINE constexpr void Swap(T& A, T& B)
|
||||
B = MoveTemp(Temp);
|
||||
}
|
||||
|
||||
/** Overloads the Swap algorithm for arrays. */
|
||||
template <typename T, typename U, size_t N> requires (CCommonReference<T, U>
|
||||
&& requires(T& A, U& B) { Swap(A, A); Swap(B, B); Swap(A, B); Swap(B, A); })
|
||||
FORCEINLINE constexpr void Swap(T(&A)[N], U(&B)[N])
|
||||
{
|
||||
for (size_t Index = 0; Index < N; ++Index)
|
||||
{
|
||||
Swap(A[Index], B[Index]);
|
||||
}
|
||||
}
|
||||
|
||||
/** Replaces the value of 'A' with 'B' and returns the old value of 'A'. */
|
||||
template <typename T, typename U = T> requires (CMoveConstructible<T> && CAssignableFrom<T&, U>)
|
||||
FORCEINLINE constexpr T Exchange(T& A, U&& B)
|
||||
|
Reference in New Issue
Block a user