From 8baaa50335607c0bf491100b0f0946fe3e08173a Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Sun, 26 Dec 2021 15:57:09 +0800 Subject: [PATCH] refactor(typetraits): remove TypeTraits namespace and bool operation template --- .../Private/Testing/TypeTraitsTesting.cpp | 585 +++++++++--------- .../Source/Public/TypeTraits/CompositeType.h | 2 - .../Source/Public/TypeTraits/HelperClasses.h | 23 - .../Source/Public/TypeTraits/Miscellaneous.h | 2 - .../Source/Public/TypeTraits/PrimaryType.h | 2 - .../Public/TypeTraits/SupportedOperations.h | 2 - .../Source/Public/TypeTraits/TypeProperties.h | 4 +- 7 files changed, 285 insertions(+), 335 deletions(-) diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index c14d9f2..afbbab1 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -47,400 +47,383 @@ void TestTypeTraits() { // HelperClasses.h - always_check((TypeTraits::TConstant::Value == 1)); - always_check(static_cast(TypeTraits::TConstant::Value) == 2); - always_check((TypeTraits::TConstant() == 3)); + always_check((TConstant::Value == 1)); + always_check(static_cast(TConstant::Value) == 2); + always_check((TConstant() == 3)); - always_check(!TypeTraits::FFalse::Value); - always_check(TypeTraits::FTrue::Value); - - always_check(TypeTraits::TAnd::Value); - always_check(!TypeTraits::TAnd::Value); - always_check((TypeTraits::TAnd::Value)); - always_check(!(TypeTraits::TAnd::Value)); - always_check(!(TypeTraits::TAnd::Value)); - always_check(!(TypeTraits::TAnd::Value)); - - always_check(TypeTraits::TOr::Value); - always_check(!TypeTraits::TOr::Value); - always_check((TypeTraits::TOr::Value)); - always_check((TypeTraits::TOr::Value)); - always_check((TypeTraits::TOr::Value)); - always_check(!(TypeTraits::TOr::Value)); - - always_check(!TypeTraits::TNot::Value); - always_check(TypeTraits::TNot::Value); + always_check(!FFalse::Value); + always_check(FTrue::Value); // PrimaryType.h - always_check(!TypeTraits::TIsVoid::Value); - always_check(TypeTraits::TIsVoid::Value); - always_check(TypeTraits::TIsVoid::Value); - always_check(TypeTraits::TIsVoid::Value); - always_check(TypeTraits::TIsVoid::Value); + always_check(!TIsVoid::Value); + always_check(TIsVoid::Value); + always_check(TIsVoid::Value); + always_check(TIsVoid::Value); + always_check(TIsVoid::Value); - always_check(!TypeTraits::TIsNullPointer::Value); - always_check(TypeTraits::TIsNullPointer::Value); + always_check(!TIsNullPointer::Value); + always_check(TIsNullPointer::Value); - always_check(TypeTraits::TIsIntegral::Value); - always_check(!TypeTraits::TIsIntegral::Value); + always_check(TIsIntegral::Value); + always_check(!TIsIntegral::Value); - always_check(!TypeTraits::TIsFloatingPoint::Value); - always_check(TypeTraits::TIsFloatingPoint::Value); + always_check(!TIsFloatingPoint::Value); + always_check(TIsFloatingPoint::Value); - always_check(!TypeTraits::TIsArray::Value); - always_check(TypeTraits::TIsArray::Value); - always_check(TypeTraits::TIsArray::Value); + always_check(!TIsArray::Value); + always_check(TIsArray::Value); + always_check(TIsArray::Value); - always_check(!TypeTraits::TIsPointer::Value); - always_check(TypeTraits::TIsPointer::Value); + always_check(!TIsPointer::Value); + always_check(TIsPointer::Value); - always_check(!TypeTraits::TIsLValueReference::Value); - always_check(TypeTraits::TIsLValueReference::Value); - always_check(!TypeTraits::TIsLValueReference::Value); + always_check(!TIsLValueReference::Value); + always_check(TIsLValueReference::Value); + always_check(!TIsLValueReference::Value); - always_check(!TypeTraits::TIsRValueReference::Value); - always_check(!TypeTraits::TIsRValueReference::Value); - always_check(TypeTraits::TIsRValueReference::Value); + always_check(!TIsRValueReference::Value); + always_check(!TIsRValueReference::Value); + always_check(TIsRValueReference::Value); - always_check(TypeTraits::TIsMemberObjectPointer::Value); - always_check(!TypeTraits::TIsMemberObjectPointer::Value); + always_check(TIsMemberObjectPointer::Value); + always_check(!TIsMemberObjectPointer::Value); - always_check(!TypeTraits::TIsMemberFunctionPointer::Value); - always_check(TypeTraits::TIsMemberFunctionPointer::Value); + always_check(!TIsMemberFunctionPointer::Value); + always_check(TIsMemberFunctionPointer::Value); - always_check(!TypeTraits::TIsEnum::Value); - always_check(!TypeTraits::TIsEnum::Value); - always_check(TypeTraits::TIsEnum::Value); - always_check(TypeTraits::TIsEnum::Value); + always_check(!TIsEnum::Value); + always_check(!TIsEnum::Value); + always_check(TIsEnum::Value); + always_check(TIsEnum::Value); - always_check(!TypeTraits::TIsUnion::Value); - always_check(!TypeTraits::TIsUnion::Value); - always_check(TypeTraits::TIsUnion::Value); + always_check(!TIsUnion::Value); + always_check(!TIsUnion::Value); + always_check(TIsUnion::Value); - always_check(!TypeTraits::TIsUnion::Value); - always_check(!TypeTraits::TIsUnion::Value); - always_check(TypeTraits::TIsUnion::Value); + always_check(!TIsUnion::Value); + always_check(!TIsUnion::Value); + always_check(TIsUnion::Value); - always_check(!TypeTraits::TIsFunction::Value); - always_check(!TypeTraits::TIsFunction::Value); - always_check(!TypeTraits::TIsFunction::Value); - always_check(TypeTraits::TIsFunction::Value); + always_check(!TIsFunction::Value); + always_check(!TIsFunction::Value); + always_check(!TIsFunction::Value); + always_check(TIsFunction::Value); // CompositeType.h - always_check(!TypeTraits::TIsFundamental::Value); - always_check(TypeTraits::TIsFundamental::Value); - always_check(TypeTraits::TIsFundamental::Value); - always_check(!TypeTraits::TIsFundamental::Value); - always_check(TypeTraits::TIsFundamental::Value); + always_check(!TIsFundamental::Value); + always_check(TIsFundamental::Value); + always_check(TIsFundamental::Value); + always_check(!TIsFundamental::Value); + always_check(TIsFundamental::Value); - always_check(!TypeTraits::TIsArithmetic::Value); - always_check(TypeTraits::TIsArithmetic::Value); - always_check(TypeTraits::TIsArithmetic::Value); - always_check(!TypeTraits::TIsArithmetic::Value); - always_check(!TypeTraits::TIsArithmetic::Value); + always_check(!TIsArithmetic::Value); + always_check(TIsArithmetic::Value); + always_check(TIsArithmetic::Value); + always_check(!TIsArithmetic::Value); + always_check(!TIsArithmetic::Value); - always_check(!TypeTraits::TIsScalar::Value); - always_check(TypeTraits::TIsScalar::Value); - always_check(TypeTraits::TIsScalar::Value); - always_check(TypeTraits::TIsScalar::Value); - always_check(!TypeTraits::TIsScalar::Value); + always_check(!TIsScalar::Value); + always_check(TIsScalar::Value); + always_check(TIsScalar::Value); + always_check(TIsScalar::Value); + always_check(!TIsScalar::Value); - always_check(TypeTraits::TIsObject::Value); - always_check(!TypeTraits::TIsObject::Value); - always_check(TypeTraits::TIsObject::Value); - always_check(TypeTraits::TIsObject::Value); - always_check(!TypeTraits::TIsObject::Value); + always_check(TIsObject::Value); + always_check(!TIsObject::Value); + always_check(TIsObject::Value); + always_check(TIsObject::Value); + always_check(!TIsObject::Value); - always_check(TypeTraits::TIsCompound::Value); - always_check(TypeTraits::TIsCompound::Value); - always_check(!TypeTraits::TIsCompound::Value); - always_check(TypeTraits::TIsCompound::Value); - always_check(TypeTraits::TIsCompound::Value); + always_check(TIsCompound::Value); + always_check(TIsCompound::Value); + always_check(!TIsCompound::Value); + always_check(TIsCompound::Value); + always_check(TIsCompound::Value); - always_check(!TypeTraits::TIsReference::Value); - always_check(!TypeTraits::TIsReference::Value); - always_check(TypeTraits::TIsReference::Value); - always_check(TypeTraits::TIsReference::Value); + always_check(!TIsReference::Value); + always_check(!TIsReference::Value); + always_check(TIsReference::Value); + always_check(TIsReference::Value); - always_check(!TypeTraits::TIsMemberPointer::Value); - always_check(TypeTraits::TIsMemberPointer::Value); + always_check(!TIsMemberPointer::Value); + always_check(TIsMemberPointer::Value); // TypeProperties.h - always_check(!TypeTraits::TIsConst::Value); - always_check(TypeTraits::TIsConst::Value); - always_check(!TypeTraits::TIsConst::Value); - always_check(TypeTraits::TIsConst::Value); + always_check(!TIsConst::Value); + always_check(TIsConst::Value); + always_check(!TIsConst::Value); + always_check(TIsConst::Value); - always_check(!TypeTraits::TIsVolatile::Value); - always_check(!TypeTraits::TIsVolatile::Value); - always_check(TypeTraits::TIsVolatile::Value); - always_check(TypeTraits::TIsVolatile::Value); + always_check(!TIsVolatile::Value); + always_check(!TIsVolatile::Value); + always_check(TIsVolatile::Value); + always_check(TIsVolatile::Value); - always_check(TypeTraits::TIsTrivial::Value); - always_check(!TypeTraits::TIsTrivial::Value); + always_check(TIsTrivial::Value); + always_check(!TIsTrivial::Value); - always_check(TypeTraits::TIsTriviallyCopyable::Value); - always_check(!TypeTraits::TIsTriviallyCopyable::Value); - always_check(!TypeTraits::TIsTriviallyCopyable::Value); + always_check(TIsTriviallyCopyable::Value); + always_check(!TIsTriviallyCopyable::Value); + always_check(!TIsTriviallyCopyable::Value); - always_check(TypeTraits::TIsStandardLayout::Value); - always_check(!TypeTraits::TIsStandardLayout::Value); - always_check(!TypeTraits::TIsStandardLayout::Value); + always_check(TIsStandardLayout::Value); + always_check(!TIsStandardLayout::Value); + always_check(!TIsStandardLayout::Value); - always_check(TypeTraits::THasUniqueObjectRepresentations::Value); - always_check(!TypeTraits::THasUniqueObjectRepresentations::Value); + always_check(THasUniqueObjectRepresentations::Value); + always_check(!THasUniqueObjectRepresentations::Value); - always_check(TypeTraits::TIsEmpty::Value); - always_check(!TypeTraits::TIsEmpty::Value); - always_check(TypeTraits::TIsEmpty::Value); - always_check(TypeTraits::TIsEmpty::Value); - always_check(!TypeTraits::TIsEmpty::Value); - always_check(!TypeTraits::TIsEmpty::Value); + always_check(TIsEmpty::Value); + always_check(!TIsEmpty::Value); + always_check(TIsEmpty::Value); + always_check(TIsEmpty::Value); + always_check(!TIsEmpty::Value); + always_check(!TIsEmpty::Value); - always_check(TypeTraits::TIsPolymorphic::Value); - always_check(!TypeTraits::TIsPolymorphic::Value); + always_check(TIsPolymorphic::Value); + always_check(!TIsPolymorphic::Value); - always_check(TypeTraits::TIsAbstract::Value); - always_check(!TypeTraits::TIsAbstract::Value); + always_check(TIsAbstract::Value); + always_check(!TIsAbstract::Value); - always_check(!TypeTraits::TIsFinal::Value); - always_check(TypeTraits::TIsFinal::Value); + always_check(!TIsFinal::Value); + always_check(TIsFinal::Value); - always_check(!TypeTraits::TIsAggregate::Value); - always_check(TypeTraits::TIsAggregate::Value); - always_check(TypeTraits::TIsAggregate::Value); - always_check(!TypeTraits::TIsAggregate::Value); + always_check(!TIsAggregate::Value); + always_check(TIsAggregate::Value); + always_check(TIsAggregate::Value); + always_check(!TIsAggregate::Value); - always_check(TypeTraits::TIsSigned::Value); - always_check(!TypeTraits::TIsSigned::Value); + always_check(TIsSigned::Value); + always_check(!TIsSigned::Value); - always_check(!TypeTraits::TIsUnsigned::Value); - always_check(TypeTraits::TIsUnsigned::Value); + always_check(!TIsUnsigned::Value); + always_check(TIsUnsigned::Value); - always_check(!TypeTraits::TIsBoundedArray::Value); - always_check(!TypeTraits::TIsBoundedArray::Value); - always_check(TypeTraits::TIsBoundedArray::Value); + always_check(!TIsBoundedArray::Value); + always_check(!TIsBoundedArray::Value); + always_check(TIsBoundedArray::Value); - always_check(!TypeTraits::TIsUnboundedArray::Value); - always_check(TypeTraits::TIsUnboundedArray::Value); - always_check(!TypeTraits::TIsUnboundedArray::Value); + always_check(!TIsUnboundedArray::Value); + always_check(TIsUnboundedArray::Value); + always_check(!TIsUnboundedArray::Value); - always_check(!TypeTraits::TIsScopedEnum::Value); - always_check(TypeTraits::TIsScopedEnum::Value); + always_check(!TIsScopedEnum::Value); + always_check(TIsScopedEnum::Value); // SupportedOperations.h - always_check(!TypeTraits::TIsDefaultConstructible::Value); - always_check(TypeTraits::TIsDefaultConstructible::Value); - always_check(TypeTraits::TIsDefaultConstructible::Value); - always_check(!TypeTraits::TIsDefaultConstructible::Value); + always_check(!TIsDefaultConstructible::Value); + always_check(TIsDefaultConstructible::Value); + always_check(TIsDefaultConstructible::Value); + always_check(!TIsDefaultConstructible::Value); - always_check(!TypeTraits::TIsTriviallyDefaultConstructible::Value); - always_check(!TypeTraits::TIsTriviallyDefaultConstructible::Value); - always_check(TypeTraits::TIsTriviallyDefaultConstructible::Value); - always_check(!TypeTraits::TIsTriviallyDefaultConstructible::Value); + always_check(!TIsTriviallyDefaultConstructible::Value); + always_check(!TIsTriviallyDefaultConstructible::Value); + always_check(TIsTriviallyDefaultConstructible::Value); + always_check(!TIsTriviallyDefaultConstructible::Value); - always_check(!(TypeTraits::TIsConstructible::Value)); - always_check((TypeTraits::TIsConstructible::Value)); - always_check((TypeTraits::TIsConstructible::Value)); + always_check(!(TIsConstructible::Value)); + always_check((TIsConstructible::Value)); + always_check((TIsConstructible::Value)); - always_check(!(TypeTraits::TIsTriviallyConstructible::Value)); - always_check((TypeTraits::TIsTriviallyConstructible::Value)); - always_check(!(TypeTraits::TIsTriviallyConstructible::Value)); + always_check(!(TIsTriviallyConstructible::Value)); + always_check((TIsTriviallyConstructible::Value)); + always_check(!(TIsTriviallyConstructible::Value)); - always_check(TypeTraits::TIsCopyConstructible::Value); - always_check(TypeTraits::TIsCopyConstructible::Value); - always_check(!TypeTraits::TIsCopyConstructible::Value); + always_check(TIsCopyConstructible::Value); + always_check(TIsCopyConstructible::Value); + always_check(!TIsCopyConstructible::Value); - always_check(!TypeTraits::TIsTriviallyCopyConstructible::Value); - always_check(TypeTraits::TIsTriviallyCopyConstructible::Value); - always_check(!TypeTraits::TIsTriviallyCopyConstructible::Value); + always_check(!TIsTriviallyCopyConstructible::Value); + always_check(TIsTriviallyCopyConstructible::Value); + always_check(!TIsTriviallyCopyConstructible::Value); - always_check(TypeTraits::TIsMoveConstructible::Value); - always_check(TypeTraits::TIsMoveConstructible::Value); - always_check(!TypeTraits::TIsMoveConstructible::Value); + always_check(TIsMoveConstructible::Value); + always_check(TIsMoveConstructible::Value); + always_check(!TIsMoveConstructible::Value); - always_check(!TypeTraits::TIsTriviallyMoveConstructible::Value); - always_check(TypeTraits::TIsTriviallyMoveConstructible::Value); - always_check(!TypeTraits::TIsTriviallyMoveConstructible::Value); + always_check(!TIsTriviallyMoveConstructible::Value); + always_check(TIsTriviallyMoveConstructible::Value); + always_check(!TIsTriviallyMoveConstructible::Value); - always_check(!(TypeTraits::TIsAssignable::Value)); - always_check((TypeTraits::TIsAssignable::Value)); - always_check((TypeTraits::TIsAssignable::Value)); + always_check(!(TIsAssignable::Value)); + always_check((TIsAssignable::Value)); + always_check((TIsAssignable::Value)); - always_check(!(TypeTraits::TIsTriviallyAssignable::Value)); - always_check((TypeTraits::TIsTriviallyAssignable::Value)); - always_check(!(TypeTraits::TIsTriviallyAssignable::Value)); + always_check(!(TIsTriviallyAssignable::Value)); + always_check((TIsTriviallyAssignable::Value)); + always_check(!(TIsTriviallyAssignable::Value)); - always_check(TypeTraits::TIsCopyAssignable::Value); - always_check(TypeTraits::TIsCopyAssignable::Value); - always_check(!TypeTraits::TIsCopyAssignable::Value); + always_check(TIsCopyAssignable::Value); + always_check(TIsCopyAssignable::Value); + always_check(!TIsCopyAssignable::Value); - always_check(!TypeTraits::TIsTriviallyCopyAssignable::Value); - always_check(TypeTraits::TIsTriviallyCopyAssignable::Value); - always_check(!TypeTraits::TIsTriviallyCopyAssignable::Value); + always_check(!TIsTriviallyCopyAssignable::Value); + always_check(TIsTriviallyCopyAssignable::Value); + always_check(!TIsTriviallyCopyAssignable::Value); - always_check(TypeTraits::TIsMoveAssignable::Value); - always_check(TypeTraits::TIsMoveAssignable::Value); - always_check(!TypeTraits::TIsMoveAssignable::Value); + always_check(TIsMoveAssignable::Value); + always_check(TIsMoveAssignable::Value); + always_check(!TIsMoveAssignable::Value); - always_check(!TypeTraits::TIsTriviallyMoveAssignable::Value); - always_check(TypeTraits::TIsTriviallyMoveAssignable::Value); - always_check(!TypeTraits::TIsTriviallyMoveAssignable::Value); + always_check(!TIsTriviallyMoveAssignable::Value); + always_check(TIsTriviallyMoveAssignable::Value); + always_check(!TIsTriviallyMoveAssignable::Value); - always_check(TypeTraits::TIsDestructible::Value); - always_check(TypeTraits::TIsDestructible::Value); - always_check(!TypeTraits::TIsDestructible::Value); + always_check(TIsDestructible::Value); + always_check(TIsDestructible::Value); + always_check(!TIsDestructible::Value); - always_check(!TypeTraits::TIsTriviallyDestructible::Value); - always_check(TypeTraits::TIsTriviallyDestructible::Value); - always_check(!TypeTraits::TIsTriviallyDestructible::Value); + always_check(!TIsTriviallyDestructible::Value); + always_check(TIsTriviallyDestructible::Value); + always_check(!TIsTriviallyDestructible::Value); - always_check(!TypeTraits::THasVirtualDestructor::Value); - always_check(TypeTraits::THasVirtualDestructor::Value); + always_check(!THasVirtualDestructor::Value); + always_check(THasVirtualDestructor::Value); // Miscellaneous.h - always_check(TypeTraits::TRank::Value == 3); - always_check(TypeTraits::TRank::Value == 4); - always_check(TypeTraits::TRank::Value == 0); + always_check(TRank::Value == 3); + always_check(TRank::Value == 4); + always_check(TRank::Value == 0); - always_check(TypeTraits::TExtent::Value == 1); - always_check((TypeTraits::TExtent::Value == 2)); - always_check(TypeTraits::TExtent::Value == 0); + always_check(TExtent::Value == 1); + always_check((TExtent::Value == 2)); + always_check(TExtent::Value == 0); - always_check(!(TypeTraits::TIsSame::Value)); - always_check((TypeTraits::TIsSame::Value)); + always_check(!(TIsSame::Value)); + always_check((TIsSame::Value)); - always_check(!(TypeTraits::TIsBaseOf::Value)); - always_check(!(TypeTraits::TIsBaseOf::Value)); - always_check((TypeTraits::TIsBaseOf::Value)); + always_check(!(TIsBaseOf::Value)); + always_check(!(TIsBaseOf::Value)); + always_check((TIsBaseOf::Value)); - always_check((TypeTraits::TIsConvertible::Value)); - always_check(!(TypeTraits::TIsConvertible::Value)); - always_check((TypeTraits::TIsConvertible::Value)); - always_check(!(TypeTraits::TIsConvertible::Value)); - always_check((TypeTraits::TIsConvertible::Value)); + always_check((TIsConvertible::Value)); + always_check(!(TIsConvertible::Value)); + always_check((TIsConvertible::Value)); + always_check(!(TIsConvertible::Value)); + always_check((TIsConvertible::Value)); - always_check((TypeTraits::TIsInvocable::Value)); - always_check((TypeTraits::TIsInvocable::Value)); - always_check((TypeTraits::TIsInvocable::Value)); - always_check(!(TypeTraits::TIsInvocable::Value)); - always_check(!(TypeTraits::TIsInvocable::Value)); + always_check((TIsInvocable::Value)); + always_check((TIsInvocable::Value)); + always_check((TIsInvocable::Value)); + always_check(!(TIsInvocable::Value)); + always_check(!(TIsInvocable::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)); - 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((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)); - 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)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check(!(TypeTraits::TIsSame::Type>::Value)); - always_check(!(TypeTraits::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)); + always_check(!(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)); - 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((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)); - 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)); - always_check(!(TypeTraits::TIsSame::Type>::Value)); - always_check(!(TypeTraits::TIsSame::Type>::Value)); - always_check(!(TypeTraits::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)); + always_check(!(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)); - 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((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)); - 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)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::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)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check(!(TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check(!(TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - TypeTraits::TAlignedStorage<32, 4>::Type Aligned4; - TypeTraits::TAlignedStorage<32, 8>::Type Aligned8; - TypeTraits::TAlignedStorage<32, 16>::Type Aligned16; - TypeTraits::TAlignedStorage<32, 32>::Type Aligned32; + TAlignedStorage<32, 4>::Type Aligned4; + TAlignedStorage<32, 8>::Type Aligned8; + TAlignedStorage<32, 16>::Type Aligned16; + TAlignedStorage<32, 32>::Type Aligned32; always_check((int64)(&Aligned4) % 4 == 0); always_check((int64)(&Aligned8) % 8 == 0); always_check((int64)(&Aligned16) % 16 == 0); always_check((int64)(&Aligned32) % 32 == 0); - always_check(sizeof(TypeTraits::TAlignedUnion<8, int32, int32>::Type) == 8); - always_check(sizeof(TypeTraits::TAlignedUnion<0, int8, int32>::Type) == 4); - always_check(sizeof(TypeTraits::TAlignedUnion<0, int32, int64>::Type) == 8); - always_check(sizeof(TypeTraits::TAlignedUnion<0, int32, double>::Type) == 8); + always_check(sizeof(TAlignedUnion<8, int32, int32>::Type) == 8); + always_check(sizeof(TAlignedUnion<0, int8, int32>::Type) == 4); + always_check(sizeof(TAlignedUnion<0, int32, int64>::Type) == 8); + always_check(sizeof(TAlignedUnion<0, int32, double>::Type) == 8); - 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)); - 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((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)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((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)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); -// always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); +// always_check((TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); - always_check((TypeTraits::TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); + always_check((TIsSame::Type>::Value)); } diff --git a/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h b/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h index cf02b3d..d5811c4 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h @@ -8,7 +8,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) template struct TIsReference : TBoolConstant> { }; template struct TIsArithmetic : TBoolConstant> { }; @@ -18,7 +17,6 @@ template struct TIsScalar : TBoolConstant struct TIsCompound : TBoolConstant> { }; template struct TIsMemberPointer : TBoolConstant> { }; -NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/TypeTraits/HelperClasses.h b/Redcraft.Utility/Source/Public/TypeTraits/HelperClasses.h index 5fc760b..42c94dc 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/HelperClasses.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/HelperClasses.h @@ -5,7 +5,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) template struct TConstant @@ -23,28 +22,6 @@ using TBoolConstant = TConstant; using FTrue = TBoolConstant; using FFalse = TBoolConstant; -template -struct TAnd; - -template -struct TAnd : TBoolConstant::Value> { }; - -template <> -struct TAnd<> : FTrue { }; - -template -struct TOr; - -template -struct TOr : TBoolConstant::Value> { }; - -template <> -struct TOr<> : FFalse { }; - -template -struct TNot : TBoolConstant { }; - -NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h index e2b6495..c4c9b32 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/Miscellaneous.h @@ -8,7 +8,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) NAMESPACE_PRIVATE_BEGIN @@ -56,7 +55,6 @@ template struct TUnderlyingType { using Type = 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) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h b/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h index eea0349..8abaf70 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h @@ -8,7 +8,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) template struct TIsVoid : TBoolConstant> { }; template struct TIsNullPointer : TBoolConstant> { }; @@ -25,7 +24,6 @@ template struct TIsUnion : TBoolConstant struct TIsClass : TBoolConstant> { }; template struct TIsFunction : TBoolConstant> { }; -NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h b/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h index b01caae..b7461dd 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h @@ -8,7 +8,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) template struct TIsDefaultConstructible : TBoolConstant> { }; template struct TIsCopyConstructible : TBoolConstant> { }; @@ -45,7 +44,6 @@ template struct TIsTriviallyConstructible : TBool //template struct TIsNothrowConstructible; -NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h b/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h index a6c2909..78493cf 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/TypeProperties.h @@ -8,7 +8,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -NAMESPACE_BEGIN(TypeTraits) template struct TIsConst : TBoolConstant> { }; template struct TIsVolatile : TBoolConstant> { }; @@ -37,9 +36,8 @@ struct TIsEnumConvertibleToInt : TBoolConstant { }; NAMESPACE_PRIVATE_END template -struct TIsScopedEnum : TAnd, TNot>> { }; +struct TIsScopedEnum : TBoolConstant::Value && !NAMESPACE_PRIVATE::TIsEnumConvertibleToInt::Value> { }; -NAMESPACE_END(TypeTraits) NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END