From fc38e3d913cd24d6ed56221117b258da6db58970 Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Sun, 26 Dec 2021 15:27:56 +0800 Subject: [PATCH] fix(typetraits): optimize TIsScopedEnum implementation and flag TInvokeResult errors --- .../Source/Private/Testing/TypeTraitsTesting.cpp | 1 + Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h | 2 +- Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index a78adc8..c14d9f2 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -437,6 +437,7 @@ void TestTypeTraits() always_check((TypeTraits::TIsSame::Type>::Value)); always_check((TypeTraits::TIsSame::Type>::Value)); +// always_check((TypeTraits::TIsSame::Type>::Value)); always_check((TypeTraits::TIsSame::Type>::Value)); always_check((TypeTraits::TIsSame::Type>::Value)); diff --git a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h index 6dc09e5..e2b6495 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h @@ -53,7 +53,7 @@ template struct TEnableIf { using Type = template struct TConditional { using Type = NAMESPACE_STD::conditional_t; }; template struct TCommonType { using Type = NAMESPACE_STD::common_type_t; }; template struct TUnderlyingType { using Type = NAMESPACE_STD::underlying_type_t; }; -template struct TInvokeResult { using Type = NAMESPACE_STD::invoke_result_t; }; +template struct TInvokeResult { using Type = NAMESPACE_STD::invoke_result_t; }; // FIXME: The result for char(&())[2] is wrong on MSVC template struct TVoid { using Type = void; }; NAMESPACE_END(TypeTraits) diff --git a/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h b/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h index bd31650..a6c2909 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h @@ -28,8 +28,8 @@ template struct TIsUnboundedArray : TBoolConstant struct TIsEnumConvertibleToInt : TBoolConstant { }; @@ -37,7 +37,7 @@ struct TIsEnumConvertibleToInt : TBoolConstant { }; NAMESPACE_PRIVATE_END template -struct TIsScopedEnum : TBoolConstant, TNot>>::Value> { }; +struct TIsScopedEnum : TAnd, TNot>> { }; NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility)