diff --git a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp index 9652d04..1011168 100644 --- a/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/ConceptsTesting.cpp @@ -58,12 +58,6 @@ void TestConcepts() always_check(!(CSameAs)); always_check((CSameAs)); - // Destructible.h - - always_check(CDestructible); - always_check(CDestructible); - always_check(!CDestructible); - // Derived.h always_check(!(CDerivedFrom)); @@ -78,27 +72,6 @@ void TestConcepts() always_check(!(CConvertibleTo)); always_check((CConvertibleTo)); - // Constructible.h - - always_check((CConstructibleFrom)); - always_check((CConstructibleFrom)); - always_check(!(CConstructibleFrom)); - always_check((CConstructibleFrom)); - always_check((CConstructibleFrom)); - - always_check(!CDefaultInitializable); - always_check(CDefaultInitializable); - always_check(CDefaultInitializable); - always_check(!CDefaultInitializable); - - always_check(CMoveConstructible); - always_check(CMoveConstructible); - always_check(!CMoveConstructible); - - always_check(CCopyConstructible); - always_check(CCopyConstructible); - always_check(!CCopyConstructible); - // BooleanTestable.h always_check(CBooleanTestable); @@ -106,14 +79,6 @@ void TestConcepts() always_check(CBooleanTestable); always_check(!CBooleanTestable); - // Assignable.h - - always_check((CAssignableFrom)); - always_check((CAssignableFrom)); - always_check((CAssignableFrom)); - always_check(!(CAssignableFrom)); - always_check(!(CAssignableFrom)); - // Common.h always_check((CCommonWith)); diff --git a/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp index 37f9fd8..4ece624 100644 --- a/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TemplatesTesting.cpp @@ -744,20 +744,20 @@ void TestTuple() Temp.Fifteenth = 0; Temp.Sixteenth = 0; - always_check(TIsDefaultConstructible::Value); - always_check(TIsTriviallyDefaultConstructible::Value); - always_check(TIsConstructible::Value); - always_check(TIsTriviallyConstructible::Value); - always_check(TIsCopyConstructible::Value); - always_check(TIsTriviallyCopyConstructible::Value); - always_check(TIsMoveConstructible::Value); - always_check(TIsTriviallyMoveConstructible::Value); - always_check(TIsCopyAssignable::Value); - always_check(TIsTriviallyCopyAssignable::Value); - always_check(TIsMoveAssignable::Value); - always_check(TIsTriviallyMoveAssignable::Value); - always_check(TIsDestructible::Value); - always_check(TIsTriviallyDestructible::Value); + always_check(CDefaultConstructible); + always_check(CTriviallyDefaultConstructible); + always_check(CConstructible); + always_check(CTriviallyConstructible); + always_check(CCopyConstructible); + always_check(CTriviallyCopyConstructible); + always_check(CMoveConstructible); + always_check(CTriviallyMoveConstructible); + always_check(CCopyAssignable); + always_check(CTriviallyCopyAssignable); + always_check(CMoveAssignable); + always_check(CTriviallyMoveAssignable); + always_check(CDestructible); + always_check(CTriviallyDestructible); } { diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index f0a4a60..47c8d6c 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -230,74 +230,74 @@ void TestTypeTraits() // SupportedOperations.h - always_check(!TIsDefaultConstructible::Value); - always_check(TIsDefaultConstructible::Value); - always_check(TIsDefaultConstructible::Value); - always_check(!TIsDefaultConstructible::Value); + always_check(!CDefaultConstructible); + always_check(CDefaultConstructible); + always_check(CDefaultConstructible); + always_check(!CDefaultConstructible); - always_check(!TIsTriviallyDefaultConstructible::Value); - always_check(!TIsTriviallyDefaultConstructible::Value); - always_check(TIsTriviallyDefaultConstructible::Value); - always_check(!TIsTriviallyDefaultConstructible::Value); + always_check(!CTriviallyDefaultConstructible); + always_check(!CTriviallyDefaultConstructible); + always_check(CTriviallyDefaultConstructible); + always_check(!CTriviallyDefaultConstructible); - always_check(!(TIsConstructible::Value)); - always_check((TIsConstructible::Value)); - always_check((TIsConstructible::Value)); + always_check(!(CConstructible)); + always_check((CConstructible)); + always_check((CConstructible)); - always_check(!(TIsTriviallyConstructible::Value)); - always_check((TIsTriviallyConstructible::Value)); - always_check(!(TIsTriviallyConstructible::Value)); + always_check(!(CTriviallyConstructible)); + always_check((CTriviallyConstructible)); + always_check(!(CTriviallyConstructible)); - always_check(TIsCopyConstructible::Value); - always_check(TIsCopyConstructible::Value); - always_check(!TIsCopyConstructible::Value); + always_check(CCopyConstructible); + always_check(CCopyConstructible); + always_check(!CCopyConstructible); - always_check(!TIsTriviallyCopyConstructible::Value); - always_check(TIsTriviallyCopyConstructible::Value); - always_check(!TIsTriviallyCopyConstructible::Value); + always_check(!CTriviallyCopyConstructible); + always_check(CTriviallyCopyConstructible); + always_check(!CTriviallyCopyConstructible); - always_check(TIsMoveConstructible::Value); - always_check(TIsMoveConstructible::Value); - always_check(!TIsMoveConstructible::Value); + always_check(CMoveConstructible); + always_check(CMoveConstructible); + always_check(!CMoveConstructible); - always_check(!TIsTriviallyMoveConstructible::Value); - always_check(TIsTriviallyMoveConstructible::Value); - always_check(!TIsTriviallyMoveConstructible::Value); + always_check(!CTriviallyMoveConstructible); + always_check(CTriviallyMoveConstructible); + always_check(!CTriviallyMoveConstructible); - always_check(!(TIsAssignable::Value)); - always_check((TIsAssignable::Value)); - always_check((TIsAssignable::Value)); + always_check(!(CAssignable)); + always_check((CAssignable)); + always_check((CAssignable)); - always_check(!(TIsTriviallyAssignable::Value)); - always_check((TIsTriviallyAssignable::Value)); - always_check(!(TIsTriviallyAssignable::Value)); + always_check(!(CTriviallyAssignable)); + always_check((CTriviallyAssignable)); + always_check(!(CTriviallyAssignable)); - always_check(TIsCopyAssignable::Value); - always_check(TIsCopyAssignable::Value); - always_check(!TIsCopyAssignable::Value); + always_check(CCopyAssignable); + always_check(CCopyAssignable); + always_check(!CCopyAssignable); - always_check(!TIsTriviallyCopyAssignable::Value); - always_check(TIsTriviallyCopyAssignable::Value); - always_check(!TIsTriviallyCopyAssignable::Value); + always_check(!CTriviallyCopyAssignable); + always_check(CTriviallyCopyAssignable); + always_check(!CTriviallyCopyAssignable); - always_check(TIsMoveAssignable::Value); - always_check(TIsMoveAssignable::Value); - always_check(!TIsMoveAssignable::Value); + always_check(CMoveAssignable); + always_check(CMoveAssignable); + always_check(!CMoveAssignable); - always_check(!TIsTriviallyMoveAssignable::Value); - always_check(TIsTriviallyMoveAssignable::Value); - always_check(!TIsTriviallyMoveAssignable::Value); + always_check(!CTriviallyMoveAssignable); + always_check(CTriviallyMoveAssignable); + always_check(!CTriviallyMoveAssignable); - always_check(TIsDestructible::Value); - always_check(TIsDestructible::Value); - always_check(!TIsDestructible::Value); + always_check(CDestructible); + always_check(CDestructible); + always_check(!CDestructible); - always_check(!TIsTriviallyDestructible::Value); - always_check(TIsTriviallyDestructible::Value); - always_check(!TIsTriviallyDestructible::Value); + always_check(!CTriviallyDestructible); + always_check(CTriviallyDestructible); + always_check(!CTriviallyDestructible); - always_check(!THasVirtualDestructor::Value); - always_check(THasVirtualDestructor::Value); + always_check(!CVirtualDestructible); + always_check(CVirtualDestructible); // Miscellaneous.h diff --git a/Redcraft.Utility/Source/Public/Concepts/Constructible.h b/Redcraft.Utility/Source/Public/Concepts/Constructible.h index edbc815..76b71b8 100644 --- a/Redcraft.Utility/Source/Public/Concepts/Constructible.h +++ b/Redcraft.Utility/Source/Public/Concepts/Constructible.h @@ -12,20 +12,11 @@ NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) template -concept CConstructibleFrom = CDestructible && TIsConstructible::Value; +concept CConstructibleFrom = CDestructible && CConstructible; template concept CDefaultInitializable = CConstructibleFrom && requires { T{}; ::new(static_cast(nullptr)) T; }; -template -concept CMoveConstructible = CConstructibleFrom && CConvertibleTo; - -template -concept CCopyConstructible = CMoveConstructible && - CConstructibleFrom && CConvertibleTo && - CConstructibleFrom && CConvertibleTo && - CConstructibleFrom && CConvertibleTo; - NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Concepts/Destructible.h b/Redcraft.Utility/Source/Public/Concepts/Destructible.h index 36c19f8..dbc924c 100644 --- a/Redcraft.Utility/Source/Public/Concepts/Destructible.h +++ b/Redcraft.Utility/Source/Public/Concepts/Destructible.h @@ -7,9 +7,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template -concept CDestructible = TIsDestructible::Value; - NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft) NAMESPACE_REDCRAFT_END diff --git a/Redcraft.Utility/Source/Public/Memory/MemoryOperator.h b/Redcraft.Utility/Source/Public/Memory/MemoryOperator.h index 34e27ed..7ef0fd8 100644 --- a/Redcraft.Utility/Source/Public/Memory/MemoryOperator.h +++ b/Redcraft.Utility/Source/Public/Memory/MemoryOperator.h @@ -13,7 +13,7 @@ NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_BEGIN(Memory) template - requires TIsDefaultConstructible::Value + requires CDefaultConstructible FORCEINLINE void DefaultConstruct(ElementType* Address, size_t Count = 1) { if constexpr (TIsZeroConstructible::Value) @@ -33,7 +33,7 @@ FORCEINLINE void DefaultConstruct(ElementType* Address, size_t Count = 1) } template - requires TIsConstructible::Value + requires CConstructible FORCEINLINE void Construct(DestinationElementType* Destination, const SourceElementType* Source, size_t Count = 1) { if constexpr (TIsBitwiseConstructible::Value) @@ -53,10 +53,10 @@ FORCEINLINE void Construct(DestinationElementType* Destination, const SourceElem } template - requires TIsCopyConstructible::Value + requires CCopyConstructible FORCEINLINE void CopyConstruct(ElementType* Destination, const ElementType* Source, size_t Count = 1) { - if constexpr (TIsTriviallyCopyConstructible::Value) + if constexpr (CTriviallyCopyConstructible) { Memory::Memcpy(Destination, Source, sizeof(ElementType) * Count); } @@ -73,10 +73,10 @@ FORCEINLINE void CopyConstruct(ElementType* Destination, const ElementType* Sour } template - requires TIsMoveConstructible::Value + requires CMoveConstructible FORCEINLINE void MoveConstruct(ElementType* Destination, ElementType* Source, size_t Count = 1) { - if constexpr (TIsTriviallyMoveConstructible::Value) + if constexpr (CTriviallyMoveConstructible) { Memory::Memmove(Destination, Source, sizeof(ElementType) * Count); } @@ -93,7 +93,7 @@ FORCEINLINE void MoveConstruct(ElementType* Destination, ElementType* Source, si } template - requires TIsConstructible::Value && TIsDestructible::Value + requires CConstructible && CDestructible FORCEINLINE void RelocateConstruct(DestinationElementType* Destination, SourceElementType* Source, size_t Count = 1) { if constexpr (TIsBitwiseRelocatable::Value) @@ -115,10 +115,10 @@ FORCEINLINE void RelocateConstruct(DestinationElementType* Destination, SourceEl } template - requires TIsDestructible::Value + requires CDestructible FORCEINLINE void Destruct(ElementType* Element, size_t Count = 1) { - if constexpr (!TIsTriviallyDestructible::Value) + if constexpr (!CTriviallyDestructible) { while (Count) { @@ -130,10 +130,10 @@ FORCEINLINE void Destruct(ElementType* Element, size_t Count = 1) } template - requires TIsCopyAssignable::Value + requires CCopyAssignable FORCEINLINE void CopyAssign(ElementType* Destination, const ElementType* Source, size_t Count = 1) { - if constexpr (TIsTriviallyCopyAssignable::Value) + if constexpr (CTriviallyCopyAssignable) { Memory::Memcpy(Destination, Source, sizeof(ElementType) * Count); } @@ -150,10 +150,10 @@ FORCEINLINE void CopyAssign(ElementType* Destination, const ElementType* Source, } template - requires TIsMoveAssignable::Value + requires CMoveAssignable FORCEINLINE void MoveAssign(ElementType* Destination, ElementType* Source, size_t Count = 1) { - if constexpr (TIsTriviallyCopyConstructible::Value) + if constexpr (CTriviallyCopyConstructible) { Memory::Memmove(Destination, Source, sizeof(ElementType) * Count); } diff --git a/Redcraft.Utility/Source/Public/Templates/Any.h b/Redcraft.Utility/Source/Public/Templates/Any.h index 4595b6e..2b57d67 100644 --- a/Redcraft.Utility/Source/Public/Templates/Any.h +++ b/Redcraft.Utility/Source/Public/Templates/Any.h @@ -68,8 +68,8 @@ struct alignas(InlineAlignment) TAny } } - template requires TIsDestructible::Type>::Value - && TIsConstructible::Type, Types...>::Value + template requires CDestructible::Type> + && CConstructible::Type, Types...> FORCEINLINE explicit TAny(TInPlaceType, Types&&... Args) { using SelectedType = typename TDecay::Type; @@ -77,7 +77,7 @@ struct alignas(InlineAlignment) TAny } template requires (!TIsSame::Type, TAny>::Value) && (!TIsTInPlaceType::Type>::Value) - && TIsDestructible::Type>::Value && TIsConstructible::Type, T&&>::Value + && CDestructible::Type> && CConstructible::Type, T&&> FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType::Type>, Forward(InValue)) { } @@ -185,7 +185,7 @@ struct alignas(InlineAlignment) TAny } template requires (!TIsSame::Type, TAny>::Value) && (!TIsTInPlaceType::Type>::Value) - && TIsDestructible::Type>::Value && TIsConstructible::Type, T&&>::Value + && CDestructible::Type> && CConstructible::Type, T&&> FORCEINLINE TAny& operator=(T&& InValue) { using SelectedType = typename TDecay::Type; @@ -203,8 +203,8 @@ struct alignas(InlineAlignment) TAny return *this; } - template requires TIsDestructible::Type>::Value - && TIsConstructible::Type, T&&>::Value + template requires CDestructible::Type> + && CConstructible::Type, T&&> FORCEINLINE typename TDecay::Type& Emplace(Types&&... Args) { ResetImpl(); @@ -221,22 +221,22 @@ struct alignas(InlineAlignment) TAny template constexpr bool HoldsAlternative() const { return IsValid() ? GetTypeInfo() == typeid(T) : false; } - template requires TIsDestructible::Type>::Value + template requires CDestructible::Type> constexpr T& GetValue() & { checkf(HoldsAlternative(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return *reinterpret_cast< T*>(GetAllocation()); } - template requires TIsDestructible::Type>::Value + template requires CDestructible::Type> constexpr T&& GetValue() && { checkf(HoldsAlternative(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast< T*>(GetAllocation())); } - template requires TIsDestructible::Type>::Value + template requires CDestructible::Type> constexpr const T& GetValue() const& { checkf(HoldsAlternative(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return *reinterpret_cast(GetAllocation()); } - template requires TIsDestructible::Type>::Value + template requires CDestructible::Type> constexpr const T&& GetValue() const&& { checkf(HoldsAlternative(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast(GetAllocation())); } - template requires TIsSame::Type>::Value&& TIsDestructible::Type>::Value + template requires TIsSame::Type>::Value&& CDestructible::Type> constexpr T& Get( T& DefaultValue) & { return HoldsAlternative() ? GetValue() : DefaultValue; } - template requires TIsSame::Type>::Value&& TIsDestructible::Type>::Value + template requires TIsSame::Type>::Value&& CDestructible::Type> constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative() ? GetValue() : DefaultValue; } FORCEINLINE void Reset() diff --git a/Redcraft.Utility/Source/Public/Templates/Atomic.h b/Redcraft.Utility/Source/Public/Templates/Atomic.h index 01b5cc8..cf0c4a7 100644 --- a/Redcraft.Utility/Source/Public/Templates/Atomic.h +++ b/Redcraft.Utility/Source/Public/Templates/Atomic.h @@ -52,8 +52,8 @@ NAMESPACE_PRIVATE_END #endif template requires CTriviallyCopyable - && TIsCopyConstructible::Value && TIsMoveConstructible::Value - && TIsCopyAssignable::Value && TIsMoveAssignable::Value + && CCopyConstructible && CMoveConstructible + && CCopyAssignable && CMoveAssignable struct TAtomic : public FSingleton { protected: diff --git a/Redcraft.Utility/Source/Public/Templates/Function.h b/Redcraft.Utility/Source/Public/Templates/Function.h index 2875575..717e60d 100644 --- a/Redcraft.Utility/Source/Public/Templates/Function.h +++ b/Redcraft.Utility/Source/Public/Templates/Function.h @@ -107,10 +107,10 @@ public: FORCEINLINE const type_info& TargetType() const requires (!bIsRef) { return IsValid() ? Storage.GetTypeInfo() : typeid(void); }; - template FORCEINLINE T& Target() & requires (!bIsRef) && TIsDestructible::Type>::Value { return static_cast< StorageType& >(Storage).template GetValue(); } - template FORCEINLINE T&& Target() && requires (!bIsRef) && TIsDestructible::Type>::Value { return static_cast< StorageType&&>(Storage).template GetValue(); } - template FORCEINLINE const T& Target() const& requires (!bIsRef) && TIsDestructible::Type>::Value { return static_cast(Storage).template GetValue(); } - template FORCEINLINE const T&& Target() const&& requires (!bIsRef) && TIsDestructible::Type>::Value { return static_cast(Storage).template GetValue(); } + template FORCEINLINE T& Target() & requires (!bIsRef) && CDestructible::Type> { return static_cast< StorageType& >(Storage).template GetValue(); } + template FORCEINLINE T&& Target() && requires (!bIsRef) && CDestructible::Type> { return static_cast< StorageType&&>(Storage).template GetValue(); } + template FORCEINLINE const T& Target() const& requires (!bIsRef) && CDestructible::Type> { return static_cast(Storage).template GetValue(); } + template FORCEINLINE const T&& Target() const&& requires (!bIsRef) && CDestructible::Type> { return static_cast(Storage).template GetValue(); } constexpr void Swap(TFunctionImpl& InValue) requires (!bIsRef) { @@ -296,7 +296,7 @@ public: template requires (!TIsTInPlaceType::Type>::Value) && (!TIsTFunctionRef::Type>::Value) && (!TIsTFunction::Type>::Value) && (!TIsTUniqueFunction::Type>::Value) - && TIsConstructible::Type, T&&>::Value && TIsCopyConstructible::Type>::Value + && CConstructible::Type, T&&> && CCopyConstructible::Type> && NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value FORCEINLINE TFunction(T&& InValue) { @@ -306,7 +306,7 @@ public: } template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value - && TIsConstructible::Type, ArgTypes...>::Value && TIsCopyConstructible::Type>::Value + && CConstructible::Type, ArgTypes...> && CCopyConstructible::Type> FORCEINLINE TFunction(TInPlaceType, ArgTypes&&... Args) { using DecayedType = typename TDecay::Type; @@ -317,7 +317,7 @@ public: template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value && (!TIsTFunctionRef::Type>::Value) && (!TIsTFunction::Type>::Value) && (!TIsTUniqueFunction::Type>::Value) - && TIsConstructible::Type, T&&>::Value && TIsCopyConstructible::Type>::Value + && CConstructible::Type, T&&> && CCopyConstructible::Type> FORCEINLINE TFunction& operator=(T&& InValue) { using DecayedType = typename TDecay::Type; @@ -329,7 +329,7 @@ public: } template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value - && TIsConstructible::Type, ArgTypes...>::Value&& TIsCopyConstructible::Type>::Value + && CConstructible::Type, ArgTypes...>&& CCopyConstructible::Type> FORCEINLINE typename TDecay::Type& Emplace(ArgTypes&&... Args) { using DecayedType = typename TDecay::Type; @@ -399,7 +399,7 @@ public: template requires (!TIsTInPlaceType::Type>::Value) && (!TIsTFunctionRef::Type>::Value) && (!TIsTFunction::Type>::Value) && (!TIsTUniqueFunction::Type>::Value) - && TIsConstructible::Type, T&&>::Value && TIsMoveConstructible::Type>::Value + && CConstructible::Type, T&&> && CMoveConstructible::Type> && NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value FORCEINLINE TUniqueFunction(T&& InValue) { @@ -409,7 +409,7 @@ public: } template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value - && TIsConstructible::Type, ArgTypes...>::Value && TIsMoveConstructible::Type>::Value + && CConstructible::Type, ArgTypes...> && CMoveConstructible::Type> FORCEINLINE TUniqueFunction(TInPlaceType, ArgTypes&&... Args) { using DecayedType = typename TDecay::Type; @@ -420,7 +420,7 @@ public: template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value && (!TIsTFunctionRef::Type>::Value) && (!TIsTFunction::Type>::Value) && (!TIsTUniqueFunction::Type>::Value) - && TIsConstructible::Type, T&&>::Value&& TIsMoveConstructible::Type>::Value + && CConstructible::Type, T&&>&& CMoveConstructible::Type> FORCEINLINE TUniqueFunction& operator=(T&& InValue) { using DecayedType = typename TDecay::Type; @@ -432,7 +432,7 @@ public: } template requires NAMESPACE_PRIVATE::TIsInvocableSignature::Type>::Value - && TIsConstructible::Type, ArgTypes...>::Value&& TIsMoveConstructible::Type>::Value + && CConstructible::Type, ArgTypes...>&& CMoveConstructible::Type> FORCEINLINE typename TDecay::Type& Emplace(ArgTypes&&... Args) { using DecayedType = typename TDecay::Type; diff --git a/Redcraft.Utility/Source/Public/Templates/Optional.h b/Redcraft.Utility/Source/Public/Templates/Optional.h index 93a84fb..02979f1 100644 --- a/Redcraft.Utility/Source/Public/Templates/Optional.h +++ b/Redcraft.Utility/Source/Public/Templates/Optional.h @@ -12,25 +12,25 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template requires TIsDestructible::Value +template requires CDestructible struct TOptional { private: template struct TAllowUnwrapping : TBoolConstant& >::Value - || TIsConstructible& >::Value - || TIsConstructible&&>::Value - || TIsConstructible&&>::Value + CConstructible& > + || CConstructible& > + || CConstructible&&> + || CConstructible&&> || TIsConvertible< TOptional&, OptionalType>::Value || TIsConvertible&, OptionalType>::Value || TIsConvertible< TOptional&&, OptionalType>::Value || TIsConvertible&&, OptionalType>::Value - || TIsAssignable& >::Value - || TIsAssignable& >::Value - || TIsAssignable&&>::Value - || TIsAssignable&&>::Value + || CAssignable& > + || CAssignable& > + || CAssignable&&> + || CAssignable&&> )> { }; public: @@ -41,39 +41,39 @@ public: constexpr TOptional(FInvalid) : TOptional() { } - template requires TIsConstructible::Value + template requires CConstructible constexpr explicit TOptional(FInPlace, Types&&... Args) : bIsValid(true) { new(&Value) OptionalType(Forward(Args)...); } - template requires TIsConstructible::Value + template requires CConstructible && (!TIsSame::Type, FInPlace>::Value) && (!TIsSame::Type, TOptional>::Value) constexpr explicit (!TIsConvertible::Value) TOptional(T&& InValue) : TOptional(InPlace, Forward(InValue)) { } - constexpr TOptional(const TOptional& InValue) requires TIsCopyConstructible::Value + constexpr TOptional(const TOptional& InValue) requires CCopyConstructible : bIsValid(InValue.IsValid()) { if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue()); } - constexpr TOptional(TOptional&& InValue) requires TIsMoveConstructible::Value + constexpr TOptional(TOptional&& InValue) requires CMoveConstructible : bIsValid(InValue.IsValid()) { if (InValue.IsValid()) new(&Value) OptionalType(MoveTemp(InValue.GetValue())); } - template requires TIsConstructible::Value && TAllowUnwrapping::Value + template requires CConstructible && TAllowUnwrapping::Value constexpr explicit (!TIsConvertible::Value) TOptional(const TOptional& InValue) : bIsValid(InValue.IsValid()) { if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue()); } - template requires TIsConstructible::Value && TAllowUnwrapping::Value + template requires CConstructible && TAllowUnwrapping::Value constexpr explicit (!TIsConvertible::Value) TOptional(TOptional&& InValue) : bIsValid(InValue.IsValid()) { @@ -82,10 +82,10 @@ public: constexpr ~TOptional() { - if constexpr (!TIsTriviallyDestructible::Value) Reset(); + if constexpr (!CTriviallyDestructible) Reset(); } - constexpr TOptional& operator=(const TOptional& InValue) requires TIsCopyConstructible::Value && TIsCopyAssignable::Value + constexpr TOptional& operator=(const TOptional& InValue) requires CCopyConstructible && CCopyAssignable { if (&InValue == this) return *this; @@ -105,7 +105,7 @@ public: return *this; } - constexpr TOptional& operator=(TOptional&& InValue) requires TIsMoveConstructible::Value && TIsMoveAssignable::Value + constexpr TOptional& operator=(TOptional&& InValue) requires CMoveConstructible && CMoveAssignable { if (&InValue == this) return *this; @@ -125,7 +125,7 @@ public: return *this; } - template requires TIsConstructible::Value && TIsAssignable::Value && TAllowUnwrapping::Value + template requires CConstructible && CAssignable && TAllowUnwrapping::Value constexpr TOptional& operator=(const TOptional& InValue) { if (!InValue.IsValid()) @@ -144,7 +144,7 @@ public: return *this; } - template requires TIsConstructible::Value && TIsAssignable::Value && TAllowUnwrapping::Value + template requires CConstructible && CAssignable && TAllowUnwrapping::Value constexpr TOptional& operator=(TOptional&& InValue) { if (!InValue.IsValid()) @@ -163,7 +163,7 @@ public: return *this; } - template requires TIsConstructible::Value && TIsAssignable::Value + template requires CConstructible && CAssignable constexpr TOptional& operator=(T&& InValue) { if (IsValid()) GetValue() = Forward(InValue); @@ -176,7 +176,7 @@ public: return *this; } - template requires TIsConstructible::Value + template requires CConstructible constexpr OptionalType& Emplace(ArgTypes&&... Args) { Reset(); @@ -223,7 +223,7 @@ public: return NAMESPACE_REDCRAFT::GetTypeHash(GetValue()); } - template requires TIsMoveConstructible::Value && TIsSwappable::Value + template requires CMoveConstructible && TIsSwappable::Value constexpr void Swap(TOptional& InValue) { if (!IsValid() && !InValue.IsValid()) return; @@ -283,19 +283,19 @@ constexpr bool operator==(const TOptional& LHS, FInvalid) return !LHS.IsValid(); } -template requires TIsDestructible::Value +template requires CDestructible constexpr TOptional::Type> MakeOptional(FInvalid) { return TOptional::Type>(Invalid); } -template requires TIsDestructible::Value && TIsConstructible::Value +template requires CDestructible && CConstructible constexpr TOptional MakeOptional(T&& InValue) { return TOptional(Forward(InValue)); } -template requires TIsDestructible::Value && TIsConstructible::Value +template requires CDestructible && CConstructible constexpr TOptional MakeOptional(Types&&... Args) { return TOptional(InPlace, Forward(Args)...); diff --git a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h index 26e2204..eb27c21 100644 --- a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h +++ b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h @@ -65,7 +65,7 @@ private: // Optimize TOptional with these hacking constexpr TReferenceWrapper(FInvalid) : Pointer(nullptr) { }; - template requires TIsDestructible::Value friend struct TOptional; + template requires CDestructible friend struct TOptional; }; @@ -116,18 +116,18 @@ private: template struct TAllowUnwrapping : TBoolConstant& >::Value - || TIsConstructible& >::Value - || TIsConstructible&&>::Value - || TIsConstructible&&>::Value + CConstructible& > + || CConstructible& > + || CConstructible&&> + || CConstructible&&> || TIsConvertible< TOptional&, OptionalType>::Value || TIsConvertible&, OptionalType>::Value || TIsConvertible< TOptional&&, OptionalType>::Value || TIsConvertible&&, OptionalType>::Value - || TIsAssignable& >::Value - || TIsAssignable& >::Value - || TIsAssignable&&>::Value - || TIsAssignable&&>::Value + || CAssignable& > + || CAssignable& > + || CAssignable&&> + || CAssignable&&> )> { }; public: @@ -138,12 +138,12 @@ public: constexpr TOptional(FInvalid) : TOptional() { } - template requires TIsConstructible::Value + template requires CConstructible constexpr explicit TOptional(FInPlace, Types&&... Args) : Reference(Forward(Args)...) { } - template requires TIsConstructible::Value + template requires CConstructible && (!TIsSame::Type, FInPlace>::Value) && (!TIsSame::Type, TOptional>::Value) constexpr explicit (!TIsConvertible::Value) TOptional(T&& InValue) : TOptional(InPlace, Forward(InValue)) @@ -152,7 +152,7 @@ public: TOptional(const TOptional& InValue) = default; TOptional(TOptional&& InValue) = default; - template requires TIsConstructible::Value && TAllowUnwrapping::Value + template requires CConstructible && TAllowUnwrapping::Value constexpr explicit (!TIsConvertible::Value) TOptional(const TOptional& InValue) : Reference(InValue.Reference) { } @@ -162,21 +162,21 @@ public: TOptional& operator=(const TOptional& InValue) = default; TOptional& operator=(TOptional&& InValue) = default; - template requires TIsConstructible::Value && TIsAssignable::Value && TAllowUnwrapping::Value + template requires CConstructible && CAssignable && TAllowUnwrapping::Value constexpr TOptional& operator=(const TOptional& InValue) { Reference = InValue.Reference; return *this; } - template requires TIsConstructible::Value && TIsAssignable::Value + template requires CConstructible && CAssignable constexpr TOptional& operator=(T&& InValue) { Reference = InValue; return *this; } - template requires TIsConstructible::Value + template requires CConstructible constexpr OptionalType& Emplace(ArgTypes&&... Args) { Reference = TReferenceWrapper(Forward(Args)...); @@ -221,7 +221,7 @@ public: private: TReferenceWrapper Reference; - template requires TIsDestructible::Value friend struct TOptional; + template requires CDestructible friend struct TOptional; }; diff --git a/Redcraft.Utility/Source/Public/Templates/Tuple.h b/Redcraft.Utility/Source/Public/Templates/Tuple.h index cc3a889..7107790 100644 --- a/Redcraft.Utility/Source/Public/Templates/Tuple.h +++ b/Redcraft.Utility/Source/Public/Templates/Tuple.h @@ -236,23 +236,23 @@ public: TTuple() = default; template requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && (true && ... && TIsConvertible::Value) constexpr TTuple(ArgTypes&&... Args) : Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward(Args)...) { } template requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && (!(true && ... && TIsConvertible::Value)) constexpr explicit TTuple(ArgTypes&&... Args) : Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward(Args)...) { } template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && ((ElementSize != 1) || !(TIsConvertible&, typename TElementType<0>::Type>::Value - || TIsConstructible::Type, const TTuple&>::Value + || CConstructible::Type, const TTuple&> || TIsSame::Type, typename TTuple::template TElementType<0>::Type>::Value)) && (true && ... && TIsConvertible::Value) constexpr TTuple(const TTuple& InValue) @@ -260,9 +260,9 @@ public: { } template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && ((ElementSize != 1) || !(TIsConvertible&, typename TElementType<0>::Type>::Value - || TIsConstructible::Type, const TTuple&>::Value + || CConstructible::Type, const TTuple&> || TIsSame::Type, typename TTuple::template TElementType<0>::Type>::Value)) && (!(true && ... && TIsConvertible::Value)) constexpr explicit TTuple(const TTuple& InValue) @@ -270,9 +270,9 @@ public: { } template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && ((ElementSize != 1) || !(TIsConvertible&&, typename TElementType<0>::Type>::Value - || TIsConstructible::Type, TTuple&&>::Value + || CConstructible::Type, TTuple&&> || TIsSame::Type, typename TTuple::template TElementType<0>::Type>::Value)) && (true && ... && TIsConvertible::Value) constexpr TTuple(TTuple&& InValue) @@ -280,9 +280,9 @@ public: { } template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsConstructible::Value) + && (true && ... && CConstructible) && ((ElementSize != 1) || !(TIsConvertible&&, typename TElementType<0>::Type>::Value - || TIsConstructible::Type, TTuple&&>::Value + || CConstructible::Type, TTuple&&> || TIsSame::Type, typename TTuple::template TElementType<0>::Type>::Value)) && (!(true && ... && TIsConvertible::Value)) constexpr explicit TTuple(TTuple&& InValue) @@ -293,7 +293,7 @@ public: TTuple(TTuple&&) = default; template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsAssignable::Value) + && (true && ... && CAssignable) constexpr TTuple& operator=(const TTuple& InValue) { Helper::Assign(*this, InValue); @@ -301,7 +301,7 @@ public: } template requires (sizeof...(OtherTypes) == ElementSize) - && (true && ... && TIsAssignable::Value) + && (true && ... && CAssignable) constexpr TTuple& operator=(TTuple&& InValue) { Helper::Assign(*this, MoveTemp(InValue)); @@ -365,21 +365,21 @@ public: template requires (true && ... && (TIsInvocable::Value && !TIsSame::Type>::Value)) constexpr auto Transform(F&& Func) volatile&& { return Helper::Transform(Forward(Func), static_cast< volatile TTuple&&>(*this)); } template requires (true && ... && (TIsInvocable::Value && !TIsSame::Type>::Value)) constexpr auto Transform(F&& Func) const volatile&& { return Helper::Transform(Forward(Func), static_cast(*this)); } - template requires TIsConstructible::Value constexpr T Construct() & { return Helper::template Construct(static_cast< TTuple& >(*this)); } - template requires TIsConstructible::Value constexpr T Construct() const & { return Helper::template Construct(static_cast(*this)); } - template requires TIsConstructible::Value constexpr T Construct() volatile& { return Helper::template Construct(static_cast< volatile TTuple& >(*this)); } - template requires TIsConstructible::Value constexpr T Construct() const volatile& { return Helper::template Construct(static_cast(*this)); } - template requires TIsConstructible::Value constexpr T Construct() && { return Helper::template Construct(static_cast< TTuple&&>(*this)); } - template requires TIsConstructible::Value constexpr T Construct() const && { return Helper::template Construct(static_cast(*this)); } - template requires TIsConstructible::Value constexpr T Construct() volatile&& { return Helper::template Construct(static_cast< volatile TTuple&&>(*this)); } - template requires TIsConstructible::Value constexpr T Construct() const volatile&& { return Helper::template Construct(static_cast(*this)); } + template requires CConstructible constexpr T Construct() & { return Helper::template Construct(static_cast< TTuple& >(*this)); } + template requires CConstructible constexpr T Construct() const & { return Helper::template Construct(static_cast(*this)); } + template requires CConstructible constexpr T Construct() volatile& { return Helper::template Construct(static_cast< volatile TTuple& >(*this)); } + template requires CConstructible constexpr T Construct() const volatile& { return Helper::template Construct(static_cast(*this)); } + template requires CConstructible constexpr T Construct() && { return Helper::template Construct(static_cast< TTuple&&>(*this)); } + template requires CConstructible constexpr T Construct() const && { return Helper::template Construct(static_cast(*this)); } + template requires CConstructible constexpr T Construct() volatile&& { return Helper::template Construct(static_cast< volatile TTuple&&>(*this)); } + template requires CConstructible constexpr T Construct() const volatile&& { return Helper::template Construct(static_cast(*this)); } constexpr size_t GetTypeHash() const requires (true && ... && CHashable) { return [this](TIndexSequence) -> size_t { return HashCombine(NAMESPACE_REDCRAFT::GetTypeHash(GetValue())...); } (TMakeIndexSequence()); } - constexpr void Swap(TTuple& InValue) requires (true && ... && (TIsMoveConstructible::Value&& TIsSwappable::Value)) + constexpr void Swap(TTuple& InValue) requires (true && ... && (CMoveConstructible&& TIsSwappable::Value)) { [&A = *this, &B = InValue](TIndexSequence) { ((NAMESPACE_REDCRAFT::Swap(A.template GetValue(), B.template GetValue())), ...); } (TMakeIndexSequence()); } diff --git a/Redcraft.Utility/Source/Public/Templates/Utility.h b/Redcraft.Utility/Source/Public/Templates/Utility.h index 59eed18..21905f2 100644 --- a/Redcraft.Utility/Source/Public/Templates/Utility.h +++ b/Redcraft.Utility/Source/Public/Templates/Utility.h @@ -62,7 +62,7 @@ constexpr T&& Forward(typename TRemoveReference::Type&& Obj) } template requires requires(T& A, T& B) { A.Swap(B); } - || (TIsMoveConstructible::Value && TIsMoveAssignable::Value) + || (CMoveConstructible && CMoveAssignable) constexpr void Swap(T& A, T& B) { if constexpr (requires(T& A, T& B) { A.Swap(B); }) @@ -77,7 +77,7 @@ constexpr void Swap(T& A, T& B) } } -template requires TIsMoveConstructible::Value && TIsAssignable::Value +template requires CMoveConstructible && CAssignable constexpr T Exchange(T& A, U&& B) { T Temp = MoveTemp(A); diff --git a/Redcraft.Utility/Source/Public/Templates/Variant.h b/Redcraft.Utility/Source/Public/Templates/Variant.h index f449879..fc849df 100644 --- a/Redcraft.Utility/Source/Public/Templates/Variant.h +++ b/Redcraft.Utility/Source/Public/Templates/Variant.h @@ -49,7 +49,7 @@ struct TVariantSelectedType; template struct TVariantSelectedType { - using TypeAlternativeA = typename TConditional::Value, U, void>::Type; + using TypeAlternativeA = typename TConditional, U, void>::Type; using TypeAlternativeB = typename TVariantSelectedType::Type; using Type = typename TConditional::Type, void>::Value, TypeAlternativeB, @@ -78,7 +78,7 @@ struct TVariantSelectedType NAMESPACE_PRIVATE_END -template requires (true && ... && TIsDestructible::Value) && (sizeof...(Types) < 0xFF) +template requires (true && ... && CDestructible) && (sizeof...(Types) < 0xFF) struct TVariant { static constexpr size_t AlternativeSize = sizeof...(Types); @@ -90,20 +90,20 @@ struct TVariant constexpr TVariant(FInvalid) : TVariant() { }; - constexpr TVariant(const TVariant& InValue) requires (true && ... && TIsCopyConstructible::Value) + constexpr TVariant(const TVariant& InValue) requires (true && ... && CCopyConstructible) : TypeIndex(static_cast(InValue.GetIndex())) { if (IsValid()) CopyConstructImpl[InValue.GetIndex()](&Value, &InValue.Value); } - constexpr TVariant(TVariant&& InValue) requires (true && ... && TIsMoveConstructible::Value) + constexpr TVariant(TVariant&& InValue) requires (true && ... && CMoveConstructible) : TypeIndex(static_cast(InValue.GetIndex())) { if (IsValid()) MoveConstructImpl[InValue.GetIndex()](&Value, &InValue.Value); } template requires (I < AlternativeSize) - && TIsConstructible::Type, ArgTypes...>::Value + && CConstructible::Type, ArgTypes...> constexpr explicit TVariant(TInPlaceIndex, ArgTypes&&... Args) : TypeIndex(I) { @@ -112,7 +112,7 @@ struct TVariant } template requires (TAlternativeIndex::Value != INDEX_NONE) - && TIsConstructible::Value>::Type, ArgTypes...>::Value + && CConstructible::Value>::Type, ArgTypes...> constexpr explicit TVariant(TInPlaceType, ArgTypes&&... Args) : TVariant(InPlaceIndex::Value>, Forward(Args)...) { } @@ -125,10 +125,10 @@ struct TVariant constexpr ~TVariant() { - if constexpr (!(true && ... && TIsTriviallyDestructible::Value)) Reset(); + if constexpr (!(true && ... && CTriviallyDestructible)) Reset(); } - constexpr TVariant& operator=(const TVariant& InValue) requires (true && ... && (TIsCopyConstructible::Value && TIsCopyAssignable::Value)) + constexpr TVariant& operator=(const TVariant& InValue) requires (true && ... && (CCopyConstructible && CCopyAssignable)) { if (&InValue == this) return *this; @@ -149,7 +149,7 @@ struct TVariant return *this; } - constexpr TVariant& operator=(TVariant&& InValue) requires (true && ... && (TIsMoveConstructible::Value && TIsMoveAssignable::Value)) + constexpr TVariant& operator=(TVariant&& InValue) requires (true && ... && (CMoveConstructible && CMoveAssignable)) { if (&InValue == this) return *this; @@ -187,7 +187,7 @@ struct TVariant } template requires (I < AlternativeSize) - && TIsConstructible::Type, ArgTypes...>::Value + && CConstructible::Type, ArgTypes...> constexpr typename TAlternativeType::Type& Emplace(ArgTypes&&... Args) { Reset(); @@ -200,7 +200,7 @@ struct TVariant } template requires (TAlternativeIndex::Value != INDEX_NONE) - && TIsConstructible::Value>::Type, ArgTypes...>::Value + && CConstructible::Value>::Type, ArgTypes...> constexpr T& Emplace(ArgTypes&&... Args) { return Emplace::Value>(Forward(Args)...); @@ -299,7 +299,7 @@ struct TVariant { if (GetIndex() == INDEX_NONE) return; - if constexpr (!(true && ... && TIsTriviallyDestructible::Value)) + if constexpr (!(true && ... && CTriviallyDestructible)) { DestroyImpl[GetIndex()](&Value); } @@ -319,7 +319,7 @@ struct TVariant return HashCombine(GetTypeHash(GetIndex()), HashImpl[GetIndex()](&Value)); } - constexpr void Swap(TVariant& InValue) requires (true && ... && (TIsMoveConstructible::Value && TIsSwappable::Value)) + constexpr void Swap(TVariant& InValue) requires (true && ... && (CMoveConstructible && TIsSwappable::Value)) { if (!IsValid() && !InValue.IsValid()) return; diff --git a/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h b/Redcraft.Utility/Source/Public/TypeTraits/BitwiseOperations.h index 8bd01e2..f35958a 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 || CArithmetic || CPointer)> { }; +template struct TIsZeroConstructible : TBoolConstant && (CEnum || CArithmetic || CPointer)> { }; // This type traits is allowed to be specialised. template struct TIsBitwiseConstructible; @@ -37,7 +37,7 @@ template struct TIsBitwiseConstructible struct TIsBitwiseConstructible : TIsConvertible { }; -template struct TIsBitwiseConstructible : TBoolConstant::Value ? TIsTriviallyCopyConstructible::Value : false> { }; +template struct TIsBitwiseConstructible : TBoolConstant::Value ? CTriviallyCopyConstructible : false> { }; template <> struct TIsBitwiseConstructible : FTrue { }; template <> struct TIsBitwiseConstructible< int8, uint8> : FTrue { }; @@ -69,7 +69,7 @@ template struct TIsBitwiseRelocatable struct TIsBitwiseRelocatable : TBoolConstant> { }; -template struct TIsBitwiseRelocatable : TBoolConstant::Value && TIsTriviallyDestructible::Value> { }; +template struct TIsBitwiseRelocatable : TBoolConstant::Value && CTriviallyDestructible> { }; // This type traits is allowed to be specialised. template struct TIsBitwiseComparable : TBoolConstant || CArithmetic || CPointer> { }; diff --git a/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h b/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h index 7a815e7..0d861f0 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/SupportedOperations.h @@ -12,44 +12,43 @@ NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_PRIVATE_BEGIN // Cpp17Destructible requirements -template -struct TIsCpp17Destructible : TBoolConstant && !NAMESPACE_STD::is_array_v && NAMESPACE_STD::is_destructible_v> { }; +template concept CCpp17Destructible = NAMESPACE_STD::is_object_v && !NAMESPACE_STD::is_array_v && NAMESPACE_STD::is_destructible_v; NAMESPACE_PRIVATE_END -template struct TIsDefaultConstructible : TBoolConstant> { }; -template struct TIsCopyConstructible : TBoolConstant> { }; -template struct TIsMoveConstructible : TBoolConstant> { }; -template struct TIsCopyAssignable : TBoolConstant> { }; -template struct TIsMoveAssignable : TBoolConstant> { }; -template struct TIsDestructible : NAMESPACE_PRIVATE::TIsCpp17Destructible { }; // Use Cpp17Destructible requirements instead of std::is_destructible +template concept CDefaultConstructible = NAMESPACE_STD::is_default_constructible_v; +template concept CCopyConstructible = NAMESPACE_STD::is_copy_constructible_v; +template concept CMoveConstructible = NAMESPACE_STD::is_move_constructible_v; +template concept CCopyAssignable = NAMESPACE_STD::is_copy_assignable_v; +template concept CMoveAssignable = NAMESPACE_STD::is_move_assignable_v; +template concept CDestructible = NAMESPACE_PRIVATE::CCpp17Destructible; // Use Cpp17Destructible requirements instead of std::is_destructible -template struct TIsTriviallyDefaultConstructible : TBoolConstant::Value && NAMESPACE_STD::is_trivially_default_constructible_v> { }; -template struct TIsTriviallyCopyConstructible : TBoolConstant::Value && NAMESPACE_STD::is_trivially_copy_constructible_v> { }; -template struct TIsTriviallyMoveConstructible : TBoolConstant::Value && NAMESPACE_STD::is_trivially_move_constructible_v> { }; -template struct TIsTriviallyCopyAssignable : TBoolConstant::Value && NAMESPACE_STD::is_trivially_copy_assignable_v> { }; -template struct TIsTriviallyMoveAssignable : TBoolConstant::Value && NAMESPACE_STD::is_trivially_move_assignable_v> { }; -template struct TIsTriviallyDestructible : TBoolConstant::Value && NAMESPACE_STD::is_trivially_destructible_v> { }; -template struct THasVirtualDestructor : TBoolConstant::Value && NAMESPACE_STD::has_virtual_destructor_v> { }; +template concept CTriviallyDefaultConstructible = CDefaultConstructible && NAMESPACE_STD::is_trivially_default_constructible_v; +template concept CTriviallyCopyConstructible = CCopyConstructible && NAMESPACE_STD::is_trivially_copy_constructible_v; +template concept CTriviallyMoveConstructible = CMoveConstructible && NAMESPACE_STD::is_trivially_move_constructible_v; +template concept CTriviallyCopyAssignable = CCopyAssignable && NAMESPACE_STD::is_trivially_copy_assignable_v; +template concept CTriviallyMoveAssignable = CMoveAssignable && NAMESPACE_STD::is_trivially_move_assignable_v; +template concept CTriviallyDestructible = CDestructible && NAMESPACE_STD::is_trivially_destructible_v; +template concept CVirtualDestructible = CDestructible && NAMESPACE_STD::has_virtual_destructor_v; -//template struct TIsNothrowDefaultConstructible; -//template struct TIsNothrowCopyConstructible; -//template struct TIsNothrowMoveConstructible; -//template struct TIsNothrowCopyAssignable; -//template struct TIsNothrowMoveAssignable; -//template struct TIsNothrowDestructible; +//template concept CNothrowDefaultConstructible; +//template concept CNothrowCopyConstructible; +//template concept CNothrowMoveConstructible; +//template concept CNothrowCopyAssignable; +//template concept CNothrowMoveAssignable; +//template concept CNothrowDestructible; -template struct TIsAssignable : TBoolConstant> { }; +template concept CAssignable = NAMESPACE_STD::is_assignable_v; -template struct TIsTriviallyAssignable : TBoolConstant::Value && NAMESPACE_STD::is_trivially_assignable_v> { }; +template concept CTriviallyAssignable = CAssignable && NAMESPACE_STD::is_trivially_assignable_v; -//template struct TIsNothrowAssignable; +//template concept CNothrowAssignable; -template struct TIsConstructible : TBoolConstant> { }; +template concept CConstructible = NAMESPACE_STD::is_constructible_v; -template struct TIsTriviallyConstructible : TBoolConstant::Value && NAMESPACE_STD::is_trivially_constructible_v> { }; +template concept CTriviallyConstructible = CConstructible && NAMESPACE_STD::is_trivially_constructible_v; -//template struct TIsNothrowConstructible; +//template concept CNothrowConstructible; NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft)