refactor(*): refactor the tool library's namespace to plural form

This commit is contained in:
2024-12-20 18:09:27 +08:00
parent 343007ffd6
commit a92422e8b2
25 changed files with 299 additions and 298 deletions

View File

@ -4,7 +4,7 @@
#include "TypeTraits/TypeTraits.h"
#include "Templates/Utility.h"
#include "Templates/TypeHash.h"
#include "Memory/Allocator.h"
#include "Memory/Allocators.h"
#include "Memory/MemoryOperator.h"
#include "Iterators/Utility.h"
#include "Iterators/BasicIterator.h"
@ -60,7 +60,7 @@ public:
/** Constructs the container with 'Count' copies of elements with 'InValue'. */
FORCEINLINE explicit TArray(size_t Count, const FElementType& InValue) requires (CCopyConstructible<T>)
: TArray(Range::Repeat(InValue, Count))
: TArray(Ranges::Repeat(InValue, Count))
{ }
/** Constructs the container with the contents of the range ['First', 'Last'). */
@ -104,7 +104,7 @@ public:
/** Constructs the container with the contents of the range. */
template <CInputRange R> requires (!CSameAs<TRemoveCVRef<R>, TArray> && CConstructibleFrom<T, TRangeReference<R>> && CMovable<T>)
FORCEINLINE explicit TArray(R&& Range) : TArray(Range::Begin(Range), Range::End(Range)) { }
FORCEINLINE explicit TArray(R&& Range) : TArray(Ranges::Begin(Range), Ranges::End(Range)) { }
/** Copy constructor. Constructs the container with the copy of the contents of 'InValue'. */
TArray(const TArray& InValue) requires (CCopyConstructible<T>)
@ -142,7 +142,7 @@ public:
}
/** Constructs the container with the contents of the initializer list. */
FORCEINLINE TArray(initializer_list<FElementType> IL) requires (CCopyConstructible<T>) : TArray(Range::Begin(IL), Range::End(IL)) { }
FORCEINLINE TArray(initializer_list<FElementType> IL) requires (CCopyConstructible<T>) : TArray(Ranges::Begin(IL), Ranges::End(IL)) { }
/** Destructs the array. The destructors of the elements are called and the used storage is deallocated. */
~TArray()
@ -256,38 +256,38 @@ public:
/** Replaces the contents with those identified by initializer list. */
TArray& operator=(initializer_list<FElementType> IL) requires (CCopyable<T>)
{
size_t NumToAllocate = Range::Num(IL);
size_t NumToAllocate = Ranges::Num(IL);
NumToAllocate = NumToAllocate > Max() ? Impl->CalculateSlackGrow (Range::Num(IL), Max()) : NumToAllocate;
NumToAllocate = NumToAllocate < Max() ? Impl->CalculateSlackShrink(Range::Num(IL), Max()) : NumToAllocate;
NumToAllocate = NumToAllocate > Max() ? Impl->CalculateSlackGrow (Ranges::Num(IL), Max()) : NumToAllocate;
NumToAllocate = NumToAllocate < Max() ? Impl->CalculateSlackShrink(Ranges::Num(IL), Max()) : NumToAllocate;
if (NumToAllocate != Max())
{
Memory::Destruct(Impl.Pointer, Num());
Impl->Deallocate(Impl.Pointer);
Impl.ArrayNum = Range::Num(IL);
Impl.ArrayNum = Ranges::Num(IL);
Impl.ArrayMax = NumToAllocate;
Impl.Pointer = Impl->Allocate(Max());
Memory::CopyConstruct<FElementType>(Impl.Pointer, Range::GetData(IL), Num());
Memory::CopyConstruct<FElementType>(Impl.Pointer, Ranges::GetData(IL), Num());
return *this;
}
if (Range::Num(IL) <= Num())
if (Ranges::Num(IL) <= Num())
{
Memory::CopyAssign(Impl.Pointer, Range::GetData(IL), Range::Num(IL));
Memory::Destruct(Impl.Pointer + Range::Num(IL), Num() - Range::Num(IL));
Memory::CopyAssign(Impl.Pointer, Ranges::GetData(IL), Ranges::Num(IL));
Memory::Destruct(Impl.Pointer + Ranges::Num(IL), Num() - Ranges::Num(IL));
}
else if (Range::Num(IL) <= Max())
else if (Ranges::Num(IL) <= Max())
{
Memory::CopyAssign(Impl.Pointer, Range::GetData(IL), Num());
Memory::CopyConstruct<FElementType>(Impl.Pointer + Num(), Range::GetData(IL) + Num(), Range::Num(IL) - Num());
Memory::CopyAssign(Impl.Pointer, Ranges::GetData(IL), Num());
Memory::CopyConstruct<FElementType>(Impl.Pointer + Num(), Ranges::GetData(IL) + Num(), Ranges::Num(IL) - Num());
}
else check_no_entry();
Impl.ArrayNum = Range::Num(IL);
Impl.ArrayNum = Ranges::Num(IL);
return *this;
}
@ -419,7 +419,7 @@ public:
{
checkf(IsValidIterator(Iter), TEXT("Read access violation. Please check IsValidIterator()."));
return Insert(Iter, Range::Repeat(InValue, Count));
return Insert(Iter, Ranges::Repeat(InValue, Count));
}
/** Inserts elements from range ['First', 'Last') before 'Iter'. */
@ -546,13 +546,13 @@ public:
template <CInputRange R> requires (CConstructibleFrom<T, TRangeReference<R>> && CAssignableFrom<T&, TRangeReference<R>> && CMovable<T>)
FORCEINLINE FIterator Insert(FConstIterator Iter, R&& Range)
{
return Insert(Iter, Range::Begin(Range), Range::End(Range));
return Insert(Iter, Ranges::Begin(Range), Ranges::End(Range));
}
/** Inserts elements from initializer list before 'Iter' in the container. */
FORCEINLINE FIterator Insert(FConstIterator Iter, initializer_list<FElementType> IL) requires (CCopyable<T>)
{
return Insert(Iter, Range::Begin(IL), Range::End(IL));
return Insert(Iter, Ranges::Begin(IL), Ranges::End(IL));
}
/** Inserts a new element into the container directly before 'Iter'. */

View File

@ -5,7 +5,7 @@
#include "Templates/Utility.h"
#include "Templates/TypeHash.h"
#include "Templates/Noncopyable.h"
#include "Memory/Allocator.h"
#include "Memory/Allocators.h"
#include "Iterators/Utility.h"
#include "Iterators/BasicIterator.h"
#include "Iterators/Sentinel.h"
@ -135,7 +135,7 @@ public:
/** Constructs the bitset with the bits of the range. */
template <CInputRange R> requires (!CSameAs<TRemoveCVRef<R>, TBitset> && CConstructibleFrom<bool, TRangeReference<R>>)
FORCEINLINE explicit TBitset(R&& Range) : TBitset(Range::Begin(Range), Range::End(Range)) { }
FORCEINLINE explicit TBitset(R&& Range) : TBitset(Ranges::Begin(Range), Ranges::End(Range)) { }
/** Copy constructor. Constructs the bitset with the copy of the bits of 'InValue'. */
FORCEINLINE TBitset(const TBitset& InValue)
@ -171,7 +171,7 @@ public:
}
/** Constructs the bitset with the bits of the initializer list. */
FORCEINLINE TBitset(initializer_list<bool> IL) : TBitset(Range::Begin(IL), Range::End(IL)) { }
FORCEINLINE TBitset(initializer_list<bool> IL) : TBitset(Ranges::Begin(IL), Ranges::End(IL)) { }
/** Destructs the bitset. The storage is deallocated. */
~TBitset()
@ -239,9 +239,9 @@ public:
/** Replaces the bits with those identified by initializer list. */
TBitset& operator=(initializer_list<bool> IL)
{
auto First = Range::Begin(IL);
auto First = Ranges::Begin(IL);
const size_t BlocksCount = (Range::Num(IL) + BlockWidth - 1) / BlockWidth;
const size_t BlocksCount = (Ranges::Num(IL) + BlockWidth - 1) / BlockWidth;
size_t NumToAllocate = BlocksCount;
@ -252,7 +252,7 @@ public:
{
Impl->Deallocate(Impl.Pointer);
Impl.BitsetNum = Range::Num(IL);
Impl.BitsetNum = Ranges::Num(IL);
Impl.BlocksMax = NumToAllocate;
Impl.Pointer = Impl->Allocate(MaxBlocks());
@ -261,7 +261,7 @@ public:
return *this;
}
Impl.BitsetNum = Range::Num(IL);
Impl.BitsetNum = Ranges::Num(IL);
for (FReference Ref : *this) Ref = *First++;

View File

@ -4,7 +4,7 @@
#include "TypeTraits/TypeTraits.h"
#include "Templates/Utility.h"
#include "Templates/TypeHash.h"
#include "Memory/Allocator.h"
#include "Memory/Allocators.h"
#include "Memory/MemoryOperator.h"
#include "Iterators/Utility.h"
#include "Iterators/BasicIterator.h"
@ -79,7 +79,7 @@ public:
/** Constructs the container with 'Count' copies of elements with 'InValue'. */
TList(size_t Count, const FElementType& InValue) requires (CCopyable<FElementType>)
: TList(Range::Repeat(InValue, Count))
: TList(Ranges::Repeat(InValue, Count))
{ }
/** Constructs the container with the contents of the range ['First', 'Last'). */
@ -106,7 +106,7 @@ public:
/** Constructs the container with the contents of the range. */
template <CInputRange R> requires (!CSameAs<TRemoveCVRef<R>, TList> && CConstructibleFrom<FElementType, TRangeReference<R>>)
FORCEINLINE explicit TList(R&& Range) : TList(Range::Begin(Range), Range::End(Range)) { }
FORCEINLINE explicit TList(R&& Range) : TList(Ranges::Begin(Range), Ranges::End(Range)) { }
/** Copy constructor. Constructs the container with the copy of the contents of 'InValue'. */
FORCEINLINE TList(const TList& InValue) requires (CCopyConstructible<FElementType>) : TList(InValue.Begin(), InValue.End()) { }
@ -115,7 +115,7 @@ public:
FORCEINLINE TList(TList&& InValue) : TList() { Swap(*this, InValue); }
/** Constructs the container with the contents of the initializer list. */
FORCEINLINE TList(initializer_list<FElementType> IL) requires (CCopyConstructible<FElementType>) : TList(Range::Begin(IL), Range::End(IL)) { }
FORCEINLINE TList(initializer_list<FElementType> IL) requires (CCopyConstructible<FElementType>) : TList(Ranges::Begin(IL), Ranges::End(IL)) { }
/** Destructs the list. The destructors of the elements are called and the used storage is deallocated. */
~TList()
@ -176,9 +176,9 @@ public:
TList& operator=(initializer_list<FElementType> IL) requires (CCopyable<FElementType>)
{
FIterator ThisIter = Begin();
const FElementType* OtherIter = Range::Begin(IL);
const FElementType* OtherIter = Ranges::Begin(IL);
while (ThisIter != End() && OtherIter != Range::End(IL))
while (ThisIter != End() && OtherIter != Ranges::End(IL))
{
*ThisIter = *OtherIter;
@ -188,18 +188,18 @@ public:
if (ThisIter == End())
{
while (OtherIter != Range::End(IL))
while (OtherIter != Ranges::End(IL))
{
EmplaceBack(*OtherIter);
++OtherIter;
}
}
else if (OtherIter == Range::End(IL))
else if (OtherIter == Ranges::End(IL))
{
Erase(ThisIter, End());
}
Impl.ListNum = Range::Num(IL);
Impl.ListNum = Ranges::Num(IL);
return *this;
}
@ -251,7 +251,7 @@ public:
/** Inserts 'Count' copies of the 'InValue' before 'Iter' in the container. */
FIterator Insert(FConstIterator Iter, size_t Count, const FElementType& InValue) requires (CCopyConstructible<FElementType>)
{
return Insert(Iter, Range::Repeat(InValue, Count));
return Insert(Iter, Ranges::Repeat(InValue, Count));
}
/** Inserts elements from range ['First', 'Last') before 'Iter'. */
@ -291,10 +291,10 @@ public:
/** Inserts elements from range ['First', 'Last') before 'Iter'. */
template <CInputRange R> requires (CConstructibleFrom<FElementType, TRangeReference<R>>)
FORCEINLINE FIterator Insert(FConstIterator Iter, R&& Range) { return Insert(Iter, Range::Begin(Range), Range::End(Range)); }
FORCEINLINE FIterator Insert(FConstIterator Iter, R&& Range) { return Insert(Iter, Ranges::Begin(Range), Ranges::End(Range)); }
/** Inserts elements from initializer list before 'Iter' in the container. */
FORCEINLINE FIterator Insert(FConstIterator Iter, initializer_list<FElementType> IL) requires (CCopyConstructible<FElementType>) { return Insert(Iter, Range::Begin(IL), Range::End(IL)); }
FORCEINLINE FIterator Insert(FConstIterator Iter, initializer_list<FElementType> IL) requires (CCopyConstructible<FElementType>) { return Insert(Iter, Ranges::Begin(IL), Ranges::End(IL)); }
/** Inserts a new element into the container directly before 'Iter'. */
template <typename... Ts> requires (CConstructibleFrom<FElementType, Ts...>)