From 19dc46364aaecb46c66642db256ab1e5119f9186 Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Wed, 22 Mar 2023 22:25:12 +0800 Subject: [PATCH] refactor(*): use CAllocatableObject instead of CElementalObject --- .../Source/Public/Containers/Array.h | 2 +- .../Source/Public/Containers/ArrayView.h | 6 +++--- .../Source/Public/Containers/Iterator.h | 3 --- .../Source/Public/Containers/StaticArray.h | 2 +- .../Source/Public/Memory/Allocator.h | 19 +++++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Containers/Array.h b/Redcraft.Utility/Source/Public/Containers/Array.h index b89f2d0..d5adbea 100644 --- a/Redcraft.Utility/Source/Public/Containers/Array.h +++ b/Redcraft.Utility/Source/Public/Containers/Array.h @@ -17,7 +17,7 @@ NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) /** Dynamic array. The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets to regular pointers to elements. */ -template Allocator = FHeapAllocator> requires (!CConst) +template Allocator = FHeapAllocator> class TArray final { private: diff --git a/Redcraft.Utility/Source/Public/Containers/ArrayView.h b/Redcraft.Utility/Source/Public/Containers/ArrayView.h index f6b41e9..c18f68f 100644 --- a/Redcraft.Utility/Source/Public/Containers/ArrayView.h +++ b/Redcraft.Utility/Source/Public/Containers/ArrayView.h @@ -14,10 +14,10 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template +template struct TStaticArray; -template A> requires (!CConst) +template A> class TArray; inline constexpr size_t DynamicExtent = INDEX_NONE; @@ -27,7 +27,7 @@ inline constexpr size_t DynamicExtent = INDEX_NONE; * the sequence at position zero. A TArrayView can either have a static extent, in which case the number of elements in the sequence * is known at compile-time and encoded in the type, or a dynamic extent. */ -template +template class TArrayView final { public: diff --git a/Redcraft.Utility/Source/Public/Containers/Iterator.h b/Redcraft.Utility/Source/Public/Containers/Iterator.h index 121bc08..c884b8e 100644 --- a/Redcraft.Utility/Source/Public/Containers/Iterator.h +++ b/Redcraft.Utility/Source/Public/Containers/Iterator.h @@ -14,9 +14,6 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -template -concept CElementalObject = CObject && CDestructible; - NAMESPACE_PRIVATE_BEGIN template using WithReference = T&; diff --git a/Redcraft.Utility/Source/Public/Containers/StaticArray.h b/Redcraft.Utility/Source/Public/Containers/StaticArray.h index 01f0195..d6fad67 100644 --- a/Redcraft.Utility/Source/Public/Containers/StaticArray.h +++ b/Redcraft.Utility/Source/Public/Containers/StaticArray.h @@ -17,7 +17,7 @@ NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) /** TStaticArray is a container that encapsulates fixed size arrays. */ -template +template struct TStaticArray final { private: diff --git a/Redcraft.Utility/Source/Public/Memory/Allocator.h b/Redcraft.Utility/Source/Public/Memory/Allocator.h index 3f5a7ae..e6043f6 100644 --- a/Redcraft.Utility/Source/Public/Memory/Allocator.h +++ b/Redcraft.Utility/Source/Public/Memory/Allocator.h @@ -12,8 +12,11 @@ NAMESPACE_MODULE_BEGIN(Utility) struct FAllocatorInterface; +template +concept CAllocatableObject = CObject && !CConst && !CVolatile; + template -concept CAllocator = !CSameAs +concept CAllocator = !CSameAs && CAllocatableObject && requires (typename A::template ForElementType& Allocator, T* InPtr, size_t Num, size_t NumAllocated) { { Allocator.Allocate(Num) } -> CSameAs; @@ -43,7 +46,7 @@ struct FAllocatorInterface */ static constexpr bool bSupportsMultipleAllocation = true; - template + template class ForElementType /*: private FSingleton*/ { public: @@ -114,8 +117,8 @@ struct FHeapAllocator { static constexpr bool bSupportsMultipleAllocation = true; - template - class ForElementType + template + class ForElementType /*: private FSingleton*/ { public: @@ -193,8 +196,8 @@ struct TInlineAllocator { static constexpr bool bSupportsMultipleAllocation = false; - template - class ForElementType + template + class ForElementType /*: private FSingleton*/ { public: @@ -275,8 +278,8 @@ struct FNullAllocator { static constexpr bool bSupportsMultipleAllocation = true; - template - class ForElementType + template + class ForElementType /*: private FSingleton*/ { public: