From a13b5832fca9fb734c2a397595741f774e48fd2a Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Tue, 11 Jan 2022 23:21:05 +0800 Subject: [PATCH] feat(typetraits): add TCommonReference and the corresponding testing --- .../Private/Testing/TypeTraitsTesting.cpp | 4 ++++ .../Source/Public/TypeTraits/Miscellaneous.h | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index afbbab1..c608dc0 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -413,6 +413,10 @@ void TestTypeTraits() always_check((TIsSame::Type>::Value)); always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); always_check((TIsSame::Type>::Value)); always_check((TIsSame::Type>::Value)); diff --git a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h index c4c9b32..a51a471 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h @@ -45,15 +45,16 @@ template struct TRemoveAllExtents { using Type = NAMESPACE_STD::rem template struct TMakeSigned { using Type = NAMESPACE_STD::make_signed_t; }; template struct TMakeUnsigned { using Type = NAMESPACE_STD::make_unsigned_t; }; -template struct TAlignedStorage { class Type { struct alignas(Align) { uint8 Pad[Size]; } Padding; }; }; -template struct TAlignedUnion { using Type = TAlignedStorage::Value, NAMESPACE_PRIVATE::TMaximum::Value>::Type; }; -template struct TDecay { using Type = NAMESPACE_STD::decay_t; }; -template struct TEnableIf { using Type = NAMESPACE_STD::enable_if_t; }; -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; }; // FIXME: The result for char(&())[2] is wrong on MSVC -template struct TVoid { using Type = void; }; +template struct TAlignedStorage { class Type { struct alignas(Align) { uint8 Pad[Size]; } Padding; }; }; +template struct TAlignedUnion { using Type = TAlignedStorage::Value, NAMESPACE_PRIVATE::TMaximum::Value>::Type; }; +template struct TDecay { using Type = NAMESPACE_STD::decay_t; }; +template struct TEnableIf { using Type = NAMESPACE_STD::enable_if_t; }; +template struct TConditional { using Type = NAMESPACE_STD::conditional_t; }; +template struct TCommonType { using Type = NAMESPACE_STD::common_type_t; }; +template struct TCommonReference { using Type = NAMESPACE_STD::common_reference_t; }; +template struct TUnderlyingType { using Type = NAMESPACE_STD::underlying_type_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_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft)