diff --git a/Redcraft.Utility/Source/Public/Templates/Any.h b/Redcraft.Utility/Source/Public/Templates/Any.h index 4ccd141..49fc0f4 100644 --- a/Redcraft.Utility/Source/Public/Templates/Any.h +++ b/Redcraft.Utility/Source/Public/Templates/Any.h @@ -119,12 +119,12 @@ struct TAnyRTTIHelper }; }; -inline constexpr size_t ANY_DEFAULT_INLINE_SIZE = 64 - sizeof(FTypeInfo) - sizeof(const FAnyRTTI*); -inline constexpr size_t ANY_DEFAULT_INLINE_ALIGNMENT = Memory::MINIMUM_ALIGNMENT; - NAMESPACE_PRIVATE_END -template +inline constexpr size_t ANY_DEFAULT_INLINE_SIZE = 64 - sizeof(FTypeInfo) - sizeof(const NAMESPACE_PRIVATE::FAnyRTTI*); +inline constexpr size_t ANY_DEFAULT_INLINE_ALIGNMENT = Memory::MINIMUM_ALIGNMENT; + +template struct TAny { template @@ -186,7 +186,7 @@ struct TAny } } - template requires (!TIsSame::Type, TAny>::Value) && (!TIsInPlaceTypeSpecialization::Type>::Value) + template requires (!TIsSame::Type, TAny>::Value) && (!TIsTInPlaceType::Type>::Value) && TIsObject::Type>::Value && (!TIsArray::Type>::Value) && TIsDestructible::Type>::Value && TIsConstructible::Type, T&&>::Value TAny(T&& InValue) : TAny(InPlaceType::Type>, Forward(InValue)) @@ -255,7 +255,7 @@ struct TAny return *this; } - template requires (!TIsSame::Type, TAny>::Value) && (!TIsInPlaceTypeSpecialization::Type>::Value) + template requires (!TIsSame::Type, TAny>::Value) && (!TIsTInPlaceType::Type>::Value) && TIsObject::Type>::Value && (!TIsArray::Type>::Value) && TIsDestructible::Type>::Value && TIsConstructible::Type, T&&>::Value TAny& operator=(T&& InValue) @@ -451,7 +451,10 @@ constexpr void Swap(TAny& A, TAny; +template struct TIsTAny : FFalse { }; +template struct TIsTAny> : FTrue { }; + +using FAny = TAny; static_assert(sizeof(FAny) == 64, "The byte size of FAny is unexpected"); diff --git a/Redcraft.Utility/Source/Public/Templates/Optional.h b/Redcraft.Utility/Source/Public/Templates/Optional.h index 01cee6f..67252a1 100644 --- a/Redcraft.Utility/Source/Public/Templates/Optional.h +++ b/Redcraft.Utility/Source/Public/Templates/Optional.h @@ -321,6 +321,9 @@ constexpr void Swap(TOptional& A, TOptional& B) Swap(*A, *B); } +template struct TIsTOptional : FFalse { }; +template struct TIsTOptional> : FTrue { }; + NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h index c28dc9e..f502631 100644 --- a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h +++ b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h @@ -40,6 +40,9 @@ private: template TReferenceWrapper(T&) -> TReferenceWrapper; +template struct TIsTReferenceWrapper : FFalse { }; +template struct TIsTReferenceWrapper> : FTrue { }; + template struct TUnwrapReference { using Type = T; }; template struct TUnwrapReference> { using Type = T&; }; diff --git a/Redcraft.Utility/Source/Public/Templates/Tuple.h b/Redcraft.Utility/Source/Public/Templates/Tuple.h index bea569c..5a0b051 100644 --- a/Redcraft.Utility/Source/Public/Templates/Tuple.h +++ b/Redcraft.Utility/Source/Public/Templates/Tuple.h @@ -379,16 +379,16 @@ TTuple(Types...) -> TTuple; template using TPair = TTuple; -template struct TIsTupleSpecialization : FFalse { }; -template struct TIsTupleSpecialization> : FTrue { }; +template struct TIsTTuple : FFalse { }; +template struct TIsTTuple> : FTrue { }; -template requires TIsTupleSpecialization::Type>::Value +template requires TIsTTuple::Type>::Value struct TTupleElementSize : TConstant::Type::ElementSize> { }; -template requires TIsTupleSpecialization::Type>::Value +template requires TIsTTuple::Type>::Value struct TTupleElementType { using Type = typename TCopyCVRef::Type, typename TRemoveCVRef::Type::template TElementType::Type>::Type; }; -template requires TIsTupleSpecialization::Type>::Value +template requires TIsTTuple::Type>::Value struct TTupleElementIndex : TupleType::template TElementIndex { }; template @@ -553,10 +553,10 @@ struct TTupleVisitImpl> NAMESPACE_PRIVATE_END -template requires (true && ... && (TIsTupleSpecialization::Type>::Value)) +template requires (true && ... && (TIsTTuple::Type>::Value)) struct TTupleCatResult { using Type = typename NAMESPACE_PRIVATE::TTupleCatResultImpl::Type..., NAMESPACE_PRIVATE::FTupleEndFlag>::Type; }; -template requires (true && ... && (TIsTupleSpecialization::Type>::Value)) +template requires (true && ... && (TIsTTuple::Type>::Value)) constexpr auto TupleCat(TTupleTypes&&... Args) { using R = typename TTupleCatResult::Type; diff --git a/Redcraft.Utility/Source/Public/Templates/Variant.h b/Redcraft.Utility/Source/Public/Templates/Variant.h index ccd585f..a42d5f2 100644 --- a/Redcraft.Utility/Source/Public/Templates/Variant.h +++ b/Redcraft.Utility/Source/Public/Templates/Variant.h @@ -245,7 +245,7 @@ struct TVariant { } template requires NAMESPACE_PRIVATE::TVariantSelectedType::Type, Types...>::Value - && (!TIsInPlaceTypeSpecialization::Type>::Value) && (!TIsInPlaceIndexSpecialization::Type>::Value) + && (!TIsTInPlaceType::Type>::Value) && (!TIsTInPlaceIndex::Type>::Value) && (!TIsSame::Type, TVariant>::Value) constexpr TVariant(T&& InValue) : TVariant(InPlaceType::Type, Types...>::Type>, Forward(InValue)) { } @@ -532,16 +532,16 @@ constexpr void Swap(TVariant& A, TVariant& B) B = MoveTemp(Temp); } -template struct TIsVariantSpecialization : FFalse { }; -template struct TIsVariantSpecialization> : FTrue { }; +template struct TIsTVariant : FFalse { }; +template struct TIsTVariant> : FTrue { }; -template requires TIsVariantSpecialization::Type>::Value +template requires TIsTVariant::Type>::Value struct TVariantAlternativeSize : TConstant { }; -template requires TIsVariantSpecialization::Type>::Value +template requires TIsTVariant::Type>::Value struct TVariantAlternativeType { using Type = typename TCopyCV::Type, typename TRemoveCVRef::Type::template TAlternativeType::Type>::Type; }; -template requires TIsVariantSpecialization::Type>::Value +template requires TIsTVariant::Type>::Value struct TVariantAlternativeIndex : VariantType::template TAlternativeIndex { }; NAMESPACE_MODULE_END(Utility) diff --git a/Redcraft.Utility/Source/Public/TypeTraits/InPlaceSpecialization.h b/Redcraft.Utility/Source/Public/TypeTraits/InPlaceSpecialization.h index 83fd117..30b2667 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/InPlaceSpecialization.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/InPlaceSpecialization.h @@ -7,11 +7,11 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template struct TIsInPlaceTypeSpecialization : FFalse { }; -template struct TIsInPlaceTypeSpecialization> : FTrue { }; +template struct TIsTInPlaceType : FFalse { }; +template struct TIsTInPlaceType> : FTrue { }; -template struct TIsInPlaceIndexSpecialization : FFalse { }; -template struct TIsInPlaceIndexSpecialization> : FTrue { }; +template struct TIsTInPlaceIndex : FFalse { }; +template struct TIsTInPlaceIndex> : FTrue { }; NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft)