![]() |
XII Release 0.1.0
|
#include <HybridArray.h>
Public Member Functions | |
| template<typename AllocatorWrapper> | |
| xiiTemporaryHybridArray (const xiiHybridArray< T, Size, AllocatorWrapper > &other) | |
| xiiTemporaryHybridArray (const xiiArrayPtr< const T > &other) | |
| template<typename AllocatorWrapper> | |
| void | operator= (const xiiHybridArray< T, Size, AllocatorWrapper > &rhs) |
| void | operator= (const xiiArrayPtr< const T > &rhs) |
| void | operator= (xiiHybridArray< T, Size > &&rhs) noexcept |
| Public Member Functions inherited from xiiHybridArray< T, Size, AllocatorWrapper > | |
| xiiHybridArray () | |
| Creates an empty array. Does not allocate any data yet. | |
| xiiHybridArray (xiiAllocator *pAllocator) | |
| Creates an empty array. Does not allocate any data yet. | |
| xiiHybridArray (const xiiHybridArray< T, Size, AllocatorWrapper > &other) | |
| Creates a copy of the given array. | |
| xiiHybridArray (const xiiArrayPtr< const T > &other) | |
| Creates a copy of the given array. | |
| xiiHybridArray (xiiHybridArray< T, Size, AllocatorWrapper > &&other) noexcept | |
| Moves the given array. | |
| void | operator= (const xiiHybridArray< T, Size, AllocatorWrapper > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (const xiiArrayPtr< const T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (xiiHybridArray< T, Size, AllocatorWrapper > &&rhs) noexcept |
| Moves the data from some other contiguous array into this one. | |
| Public Member Functions inherited from xiiDynamicArray< T, xiiDefaultAllocatorWrapper > | |
| XII_DECLARE_MEM_RELOCATABLE_TYPE () | |
| void | operator= (const xiiDynamicArray< T, xiiDefaultAllocatorWrapper > &rhs) |
| Public Member Functions inherited from xiiDynamicArrayBase< T > | |
| void | Reserve (xiiUInt32 uiCapacity) |
| Expands the array so it can at least store the given capacity. | |
| void | Compact () |
| xiiAllocator * | GetAllocator () const |
| Returns the allocator that is used by this instance. | |
| xiiUInt64 | GetHeapMemoryUsage () const |
| Returns the amount of bytes that are currently allocated on the heap. | |
| void | Swap (xiiDynamicArrayBase< T > &other) |
| swaps the contents of this array with another one | |
| Public Member Functions inherited from xiiArrayBase< T, xiiDynamicArrayBase< T > > | |
| xiiArrayBase () | |
| Constructor. | |
| ~xiiArrayBase () | |
| Destructor. | |
| void | operator= (const xiiArrayPtr< const T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| operator xiiArrayPtr< const T > () const | |
| Conversion to const xiiArrayPtr. | |
| operator xiiArrayPtr< T > () | |
| Conversion to xiiArrayPtr. | |
| bool | operator== (const xiiArrayBase< T, xiiDynamicArrayBase< T > > &rhs) const |
| Compares this array to another contiguous array type. | |
| bool | operator< (const xiiArrayBase< T, xiiDynamicArrayBase< T > > &rhs) const |
| Compares this array to another contiguous array type. | |
| const T & | operator[] (xiiUInt32 uiIndex) const |
| Returns the element at the given index. Does bounds checks in debug builds. | |
| void | SetCount (xiiUInt32 uiCount) |
| Resizes the array to have exactly uiCount elements. Default constructs extra elements if the array is grown. | |
| void | SetCountUninitialized (xiiUInt32 uiCount) |
| Resizes the array to have exactly uiCount elements. Extra elements might be uninitialized. | |
| void | EnsureCount (xiiUInt32 uiCount) |
| xiiUInt32 | GetCount () const |
| Returns the number of active elements in the array. | |
| bool | IsEmpty () const |
| Returns true, if the array does not contain any elements. | |
| void | Clear () |
| Clears the array. | |
| bool | Contains (const T &value) const |
| Checks whether the given value can be found in the array. O(n) complexity. | |
| void | InsertAt (xiiUInt32 uiIndex, const T &value) |
| Inserts value at index by shifting all following elements. | |
| void | InsertRange (const xiiArrayPtr< const T > &range, xiiUInt32 uiIndex) |
| Inserts all elements in the range starting at the given index, shifting the elements after the index. | |
| bool | RemoveAndCopy (const T &value) |
| Removes the first occurrence of value and fills the gap by shifting all following elements. | |
| bool | RemoveAndSwap (const T &value) |
| Removes the first occurrence of value and fills the gap by swapping in the last element. | |
| void | RemoveAtAndCopy (xiiUInt32 uiIndex, xiiUInt32 uiNumElements=1) |
| Removes the element at index and fills the gap by shifting all following elements. | |
| void | RemoveAtAndSwap (xiiUInt32 uiIndex, xiiUInt32 uiNumElements=1) |
| Removes the element at index and fills the gap by swapping in the last element. | |
| xiiUInt32 | IndexOf (const T &value, xiiUInt32 uiStartIndex=0) const |
| Searches for the first occurrence of the given value and returns its index or xiiInvalidIndex if not found. | |
| xiiUInt32 | LastIndexOf (const T &value, xiiUInt32 uiStartIndex=xiiInvalidIndex) const |
| Searches for the last occurrence of the given value and returns its index or xiiInvalidIndex if not found. | |
| T & | ExpandAndGetRef () |
| Grows the array by one element and returns a reference to the newly created element. | |
| T * | ExpandBy (xiiUInt32 uiNumNewItems) |
| Expands the array by N new items and returns a pointer to the first new one. | |
| void | PushBack (const T &value) |
| Pushes value at the end of the array. | |
| void | PushBackUnchecked (const T &value) |
| Pushes value at the end of the array. Does NOT ensure capacity. | |
| void | PushBackRange (const xiiArrayPtr< const T > &range) |
| Pushes all elements in range at the end of the array. Increases the capacity if necessary. | |
| void | PopBack (xiiUInt32 uiCountToRemove=1) |
| Removes count elements from the end of the array. | |
| T & | PeekBack () |
| Returns the last element of the array. | |
| void | Sort (const Comparer &comparer) |
| Sort with explicit comparer. | |
| T * | GetData () |
| Returns a pointer to the array data, or nullptr if the array is empty. | |
| xiiArrayPtr< T > | GetArrayPtr () |
| Returns an array pointer to the array data, or an empty array pointer if the array is empty. | |
| xiiArrayPtr< typename xiiArrayPtr< T >::ByteType > | GetByteArrayPtr () |
| Returns a byte array pointer to the array data, or an empty array pointer if the array is empty. | |
| xiiUInt32 | GetCapacity () const |
| Returns the reserved number of elements that the array can hold without reallocating. | |
Additional Inherited Members | |
| Public Types inherited from xiiArrayBase< T, xiiDynamicArrayBase< T > > | |
| using | ValueType |
| using | const_iterator |
| using | const_reverse_iterator |
| using | iterator |
| using | reverse_iterator |
| Protected Member Functions inherited from xiiHybridArray< T, Size, AllocatorWrapper > | |
| XII_ALWAYS_INLINE T * | GetStaticArray () |
| XII_ALWAYS_INLINE const T * | GetStaticArray () const |
| Protected Member Functions inherited from xiiDynamicArrayBase< T > | |
| xiiDynamicArrayBase (xiiAllocator *pAllocator) | |
| Creates an empty array. Does not allocate any data yet. | |
| xiiDynamicArrayBase (T *pInplaceStorage, xiiUInt32 uiCapacity, xiiAllocator *pAllocator) | |
| xiiDynamicArrayBase (const xiiDynamicArrayBase< T > &other, xiiAllocator *pAllocator) | |
| Creates a copy of the given array. | |
| xiiDynamicArrayBase (xiiDynamicArrayBase< T > &&other, xiiAllocator *pAllocator) | |
| Moves the given array into this one. | |
| xiiDynamicArrayBase (const xiiArrayPtr< const T > &other, xiiAllocator *pAllocator) | |
| Creates a copy of the given array. | |
| ~xiiDynamicArrayBase () | |
| Destructor. | |
| void | operator= (const xiiDynamicArrayBase< T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (xiiDynamicArrayBase< T > &&rhs) noexcept |
| Moves the data from some other contiguous array into this one. | |
| T * | GetElementsPtr () |
| const T * | GetElementsPtr () const |
| Protected Member Functions inherited from xiiArrayBase< T, xiiDynamicArrayBase< T > > | |
| void | DoSwap (xiiArrayBase< T, xiiDynamicArrayBase< T > > &other) |
| Protected Attributes inherited from xiiArrayBase< T, xiiDynamicArrayBase< T > > | |
| T * | m_pElements |
| Element-type access to m_Data. | |
| xiiUInt32 | m_uiCount |
| The number of elements used from the array. | |
| xiiUInt32 | m_uiCapacity |
| The number of elements which can be stored in the array without re-allocating. | |
A hybrid array that uses the temp allocator if it exceeds the in-place storage.
This is ideal for temporary arrays that are only used within a short scope and are not expected to grow beyond the in-place storage size in most cases. The temporary allocator is optimized for short-lived allocations and can be more efficient than the default allocator for this use case.