diff --git a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp index 0208125..9652d04 100644 --- a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp @@ -99,25 +99,6 @@ void TestConcepts() always_check(CCopyConstructible); always_check(!CCopyConstructible); - // BuiltinType.h - - always_check(CIntegral); - always_check(CIntegral); - always_check(!CIntegral); - - always_check(CSignedIntegral); - always_check(!CSignedIntegral); - - always_check(!CUnsignedIntegral); - always_check(CUnsignedIntegral); - - always_check(!CNonBooleanIntegral); - always_check(CNonBooleanIntegral); - always_check(!CNonBooleanIntegral); - - always_check(!CFloatingPoint); - always_check(CFloatingPoint); - // BooleanTestable.h always_check(CBooleanTestable); diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index b515e6a..5e0a0a1 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -120,43 +120,49 @@ void TestTypeTraits() // CompositeType.h - always_check(!TIsFundamental::Value); - always_check(TIsFundamental::Value); - always_check(TIsFundamental::Value); - always_check(!TIsFundamental::Value); - always_check(TIsFundamental::Value); + always_check(!CFundamental); + always_check(CFundamental); + always_check(CFundamental); + always_check(!CFundamental); + always_check(CFundamental); - always_check(!TIsArithmetic::Value); - always_check(TIsArithmetic::Value); - always_check(TIsArithmetic::Value); - always_check(!TIsArithmetic::Value); - always_check(!TIsArithmetic::Value); + always_check(!CArithmetic); + always_check(CArithmetic); + always_check(CArithmetic); + always_check(!CArithmetic); + always_check(!CArithmetic); - always_check(!TIsScalar::Value); - always_check(TIsScalar::Value); - always_check(TIsScalar::Value); - always_check(TIsScalar::Value); - always_check(!TIsScalar::Value); + always_check(!CScalar); + always_check(CScalar); + always_check(CScalar); + always_check(CScalar); + always_check(!CScalar); - always_check(TIsObject::Value); - always_check(!TIsObject::Value); - always_check(TIsObject::Value); - always_check(TIsObject::Value); - always_check(!TIsObject::Value); + always_check(CObject); + always_check(!CObject); + always_check(CObject); + always_check(CObject); + always_check(!CObject); - always_check(TIsCompound::Value); - always_check(TIsCompound::Value); - always_check(!TIsCompound::Value); - always_check(TIsCompound::Value); - always_check(TIsCompound::Value); + always_check(CCompound); + always_check(CCompound); + always_check(!CCompound); + always_check(CCompound); + always_check(CCompound); - always_check(!TIsReference::Value); - always_check(!TIsReference::Value); - always_check(TIsReference::Value); - always_check(TIsReference::Value); + always_check(!CReference); + always_check(!CReference); + always_check(CReference); + always_check(CReference); - always_check(!TIsMemberPointer::Value); - always_check(TIsMemberPointer::Value); + always_check(!CMemberPointer); + always_check(CMemberPointer); + + always_check(CSignedIntegral); + always_check(!CSignedIntegral); + + always_check(!CUnsignedIntegral); + always_check(CUnsignedIntegral); // TypeProperties.h diff --git a/Redcraft.Utility/Source/Public/Concepts/BuiltinType.h b/Redcraft.Utility/Source/Public/Concepts/BuiltinType.h index 18e6292..dbc924c 100644 --- a/Redcraft.Utility/Source/Public/Concepts/BuiltinType.h +++ b/Redcraft.Utility/Source/Public/Concepts/BuiltinType.h @@ -7,10 +7,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template concept CSignedIntegral = CIntegral && TIsSigned::Value; -template concept CUnsignedIntegral = CIntegral && TIsUnsigned::Value; -template concept CNonBooleanIntegral = CIntegral && !TIsSame::Type, bool>::Value; - NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Concepts/Objects.h b/Redcraft.Utility/Source/Public/Concepts/Objects.h index f430bc9..c4c60c6 100644 --- a/Redcraft.Utility/Source/Public/Concepts/Objects.h +++ b/Redcraft.Utility/Source/Public/Concepts/Objects.h @@ -13,7 +13,7 @@ NAMESPACE_MODULE_BEGIN(Utility) template concept CMovable = - TIsObject::Value && + CObject && CMoveConstructible && CAssignableFrom && CSwappable; diff --git a/Redcraft.Utility/Source/Public/Templates/Function.h b/Redcraft.Utility/Source/Public/Templates/Function.h index edf3b50..2875575 100644 --- a/Redcraft.Utility/Source/Public/Templates/Function.h +++ b/Redcraft.Utility/Source/Public/Templates/Function.h @@ -42,7 +42,7 @@ NAMESPACE_PRIVATE_BEGIN template constexpr bool FunctionIsBound(const T& Func) { - if constexpr (CPointer || TIsMemberPointer::Value || TIsTFunctionRef::Value || TIsTFunction::Value || TIsTUniqueFunction::Value) + if constexpr (CPointer || CMemberPointer || TIsTFunctionRef::Value || TIsTFunction::Value || TIsTUniqueFunction::Value) { return !!Func; } @@ -171,7 +171,7 @@ protected: Callable = [](StorageRef Storage, Types&&... Args) -> ResultType { using InvokeType = typename TConditional< - TIsReference::Value, + CReference, typename TCopyCVRef::Type, typename TCopyCVRef::Type& >::Type; diff --git a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h index a0adb57..26e2204 100644 --- a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h +++ b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h @@ -10,7 +10,7 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template requires (TIsObject::Value || CFunction) +template requires (CObject || CFunction) struct TReferenceWrapper { public: @@ -61,7 +61,7 @@ private: ReferencedType* Pointer; - template requires (TIsObject::Value || CFunction) friend struct TReferenceWrapper; + template requires (CObject || CFunction) friend struct TReferenceWrapper; // Optimize TOptional with these hacking constexpr TReferenceWrapper(FInvalid) : Pointer(nullptr) { }; diff --git a/Redcraft.Utility/Source/Public/Templates/Utility.h b/Redcraft.Utility/Source/Public/Templates/Utility.h index 0a3dc73..59eed18 100644 --- a/Redcraft.Utility/Source/Public/Templates/Utility.h +++ b/Redcraft.Utility/Source/Public/Templates/Utility.h @@ -88,13 +88,13 @@ constexpr T Exchange(T& A, U&& B) template constexpr T&& DeclVal(); -template requires TIsObject::Value +template requires CObject constexpr T* AddressOf(T& Object) { return reinterpret_cast(&const_cast(reinterpret_cast(Object))); } -template requires (!TIsObject::Value) +template requires (!CObject) constexpr T* AddressOf(T& Object) { return &Object; diff --git a/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h b/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h index feb5ad6..8bd01e2 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h @@ -14,7 +14,7 @@ NAMESPACE_MODULE_BEGIN(Utility) // Assume that all operands of bitwise operations have the same size // This type traits is allowed to be specialised. -template struct TIsZeroConstructible : TBoolConstant::Value && (CEnum || TIsArithmetic::Value || CPointer)> { }; +template struct TIsZeroConstructible : TBoolConstant::Value && (CEnum || CArithmetic || CPointer)> { }; // This type traits is allowed to be specialised. template struct TIsBitwiseConstructible; @@ -67,12 +67,12 @@ template struct TIsBitwiseRelocatable struct TIsBitwiseRelocatable : TIsBitwiseRelocatable { }; template struct TIsBitwiseRelocatable : TIsBitwiseRelocatable { }; -template struct TIsBitwiseRelocatable : TBoolConstant::Value> { }; +template struct TIsBitwiseRelocatable : TBoolConstant> { }; template struct TIsBitwiseRelocatable : TBoolConstant::Value && TIsTriviallyDestructible::Value> { }; // This type traits is allowed to be specialised. -template struct TIsBitwiseComparable : TBoolConstant || TIsArithmetic::Value || CPointer> { }; +template struct TIsBitwiseComparable : TBoolConstant || CArithmetic || CPointer> { }; NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) diff --git a/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h b/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h index d5811c4..7b4751e 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/CompositeType.h @@ -1,7 +1,8 @@ #pragma once #include "CoreTypes.h" -#include "TypeTraits/HelperClasses.h" +#include "TypeTraits/PrimaryType.h" +#include "TypeTraits/TypeProperties.h" #include @@ -9,13 +10,16 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template struct TIsReference : TBoolConstant> { }; -template struct TIsArithmetic : TBoolConstant> { }; -template struct TIsFundamental : TBoolConstant> { }; -template struct TIsObject : TBoolConstant> { }; -template struct TIsScalar : TBoolConstant> { }; -template struct TIsCompound : TBoolConstant> { }; -template struct TIsMemberPointer : TBoolConstant> { }; +template concept CReference = NAMESPACE_STD::is_reference_v; +template concept CArithmetic = NAMESPACE_STD::is_arithmetic_v; +template concept CFundamental = NAMESPACE_STD::is_fundamental_v; +template concept CObject = NAMESPACE_STD::is_object_v; +template concept CScalar = NAMESPACE_STD::is_scalar_v; +template concept CCompound = NAMESPACE_STD::is_compound_v; +template concept CMemberPointer = NAMESPACE_STD::is_member_pointer_v; + +template concept CSignedIntegral = CIntegral && TIsSigned::Value; +template concept CUnsignedIntegral = CIntegral && TIsUnsigned::Value; NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) diff --git a/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h b/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h index 1b899ce..de4a934 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/PrimaryType.h @@ -1,7 +1,6 @@ #pragma once #include "CoreTypes.h" -#include "TypeTraits/HelperClasses.h" #include