feat(containers): add TArray::Reference and TArray::ConstReference etc

This commit is contained in:
_Redstone_c_ 2023-03-01 18:32:32 +08:00
parent a15ff69809
commit 7a8a1648d1
3 changed files with 12 additions and 4 deletions

View File

@ -111,6 +111,9 @@ public:
using ElementType = T;
using AllocatorType = Allocator;
using Reference = T&;
using ConstReference = const T&;
using Iterator = NAMESPACE_PRIVATE::TArrayIterator<TArray, ElementType>;
using ConstIterator = NAMESPACE_PRIVATE::TArrayIterator<TArray, const ElementType>;
@ -1189,8 +1192,8 @@ private:
FORCEINLINE size_t& GetMax() { return ArrayMax; }
FORCEINLINE size_t GetMax() const { return ArrayMax; }
FORCEINLINE A& GetAllocator() { return Allocator; }
FORCEINLINE const A& GetAllocator() const { return Allocator; }
FORCEINLINE A& GetAllocator() { return AllocatorInstance; }
FORCEINLINE const A& GetAllocator() const { return AllocatorInstance; }
private:
@ -1199,7 +1202,7 @@ private:
size_t ArrayNum;
size_t ArrayMax;
A Allocator;
A AllocatorInstance;
};

View File

@ -140,6 +140,8 @@ public:
using ElementType = T;
using Reference = T&;
using Iterator = NAMESPACE_PRIVATE::TArrayViewIterator<ElementType>;
using ReverseIterator = TReverseIterator<Iterator>;

View File

@ -23,6 +23,9 @@ struct TStaticArray final
using ElementType = T;
using Reference = T&;
using ConstReference = const T&;
using Iterator = TArrayView< T, N>::Iterator;
using ConstIterator = TArrayView<const T, N>::Iterator;