From f54386d1021a919094b767d2d2c3c3a4db247109 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Tue, 17 Dec 2024 22:14:00 +0800 Subject: [PATCH] fix(templates): fix recursive #include due to native array swap function --- Redcraft.Utility/Source/Public/Templates/Utility.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Templates/Utility.h b/Redcraft.Utility/Source/Public/Templates/Utility.h index bed4fe9..3f652fa 100644 --- a/Redcraft.Utility/Source/Public/Templates/Utility.h +++ b/Redcraft.Utility/Source/Public/Templates/Utility.h @@ -1,7 +1,6 @@ #pragma once #include "CoreTypes.h" -#include "TypeTraits/Common.h" #include "TypeTraits/Miscellaneous.h" #include "TypeTraits/SupportedOperations.h" @@ -74,11 +73,10 @@ FORCEINLINE constexpr void Swap(T& A, T& B) } /** Overloads the Swap algorithm for arrays. */ -template requires (CCommonReference - && 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]) +template requires (requires(T& A, T& B) { Swap(A, B); }) +FORCEINLINE constexpr void Swap(T(&A)[N], T(&B)[N]) { - for (size_t Index = 0; Index < N; ++Index) + for (size_t Index = 0; Index != N; ++Index) { Swap(A[Index], B[Index]); }