![]() |
ezEngine Release 26.9
|
#include <HybridArray.h>

Public Member Functions | |
| template<typename AllocatorWrapper > | |
| ezTempHybridArray (const ezHybridArray< T, Size, AllocatorWrapper > &other) | |
| ezTempHybridArray (const ezArrayPtr< const T > &other) | |
| template<typename AllocatorWrapper > | |
| void | operator= (const ezHybridArray< T, Size, AllocatorWrapper > &rhs) |
| void | operator= (const ezArrayPtr< const T > &rhs) |
| void | operator= (ezHybridArray< T, Size > &&rhs) noexcept |
Public Member Functions inherited from ezHybridArray< T, Size, AllocatorWrapper > | |
| ezHybridArray () | |
| Creates an empty array. Does not allocate any data yet. | |
| ezHybridArray (ezAllocator *pAllocator) | |
| Creates an empty array. Does not allocate any data yet. | |
| ezHybridArray (const ezHybridArray< T, Size, AllocatorWrapper > &other) | |
| Creates a copy of the given array. | |
| ezHybridArray (const ezArrayPtr< const T > &other) | |
| Creates a copy of the given array. | |
| ezHybridArray (ezHybridArray< T, Size, AllocatorWrapper > &&other) noexcept | |
| Moves the given array. | |
| void | operator= (const ezHybridArray< T, Size, AllocatorWrapper > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (const ezArrayPtr< const T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (ezHybridArray< T, Size, AllocatorWrapper > &&rhs) noexcept |
| Moves the data from some other contiguous array into this one. | |
Public Member Functions inherited from ezDynamicArray< T, AllocatorWrapper > | |
| EZ_DECLARE_MEM_RELOCATABLE_TYPE () | |
| ezDynamicArray (ezAllocator *pAllocator) | |
| ezDynamicArray (const ezDynamicArray< T, AllocatorWrapper > &other) | |
| ezDynamicArray (const ezDynamicArrayBase< T > &other) | |
| ezDynamicArray (const ezArrayPtr< const T > &other) | |
| ezDynamicArray (ezDynamicArray< T, AllocatorWrapper > &&other) | |
| ezDynamicArray (ezDynamicArrayBase< T > &&other) | |
| void | operator= (const ezDynamicArray< T, AllocatorWrapper > &rhs) |
| void | operator= (const ezDynamicArrayBase< T > &rhs) |
| void | operator= (const ezArrayPtr< const T > &rhs) |
| void | operator= (ezDynamicArray< T, AllocatorWrapper > &&rhs) noexcept |
| void | operator= (ezDynamicArrayBase< T > &&rhs) noexcept |
Public Member Functions inherited from ezDynamicArrayBase< T > | |
| void | Reserve (ezUInt32 uiCapacity) |
| Expands the array so it can at least store the given capacity. | |
| void | Compact () |
| Tries to compact the array to avoid wasting memory. The resulting capacity is at least 'GetCount' (no elements get removed). Will deallocate all data, if the array is empty. | |
| ezAllocator * | GetAllocator () const |
| Returns the allocator that is used by this instance. | |
| ezUInt64 | GetHeapMemoryUsage () const |
| Returns the amount of bytes that are currently allocated on the heap. | |
| void | Swap (ezDynamicArrayBase< T > &other) |
| swaps the contents of this array with another one | |
Public Member Functions inherited from ezArrayBase< T, ezDynamicArrayBase< T > > | |
| ezArrayBase () | |
| Constructor. | |
| ~ezArrayBase () | |
| Destructor. | |
| void | operator= (const ezArrayPtr< const T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| operator ezArrayPtr< const T > () const | |
| Conversion to const ezArrayPtr. | |
| operator ezArrayPtr< T > () | |
| Conversion to ezArrayPtr. | |
| bool | operator== (const ezArrayBase< T, ezDynamicArrayBase< T > > &rhs) const |
| Compares this array to another contiguous array type. | |
| EZ_ADD_DEFAULT_OPERATOR_NOTEQUAL (const ezArrayBase< T, ezDynamicArrayBase< T > > &) | |
| bool | operator< (const ezArrayBase< T, ezDynamicArrayBase< T > > &rhs) const |
| Compares this array to another contiguous array type. | |
| bool | operator< (const ezArrayPtr< const T > &rhs) const |
| Compares this array to another contiguous array type. | |
| const T & | operator[] (ezUInt32 uiIndex) const |
| Returns the element at the given index. Does bounds checks in debug builds. | |
| T & | operator[] (ezUInt32 uiIndex) |
| Returns the element at the given index. Does bounds checks in debug builds. | |
| void | SetCount (ezUInt32 uiCount) |
| Resizes the array to have exactly uiCount elements. Default constructs extra elements if the array is grown. | |
| void | SetCount (ezUInt32 uiCount, const T &fillValue) |
| Resizes the array to have exactly uiCount elements. Constructs all new elements by copying the FillValue. | |
| void | SetCountUninitialized (ezUInt32 uiCount) |
| Resizes the array to have exactly uiCount elements. Extra elements might be uninitialized. | |
| void | EnsureCount (ezUInt32 uiCount) |
| Ensures the container has at least uiCount elements. Ie. calls SetCount() if the container has fewer elements, does nothing otherwise. | |
| ezUInt32 | 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 (ezUInt32 uiIndex, const T &value) |
| Inserts value at index by shifting all following elements. | |
| void | InsertAt (ezUInt32 uiIndex, T &&value) |
| Inserts value at index by shifting all following elements. | |
| void | InsertRangeAt (ezUInt32 uiIndex, const ezArrayPtr< const T > &range) |
| 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 (ezUInt32 uiIndex, ezUInt32 uiNumElements=1) |
| Removes the element at index and fills the gap by shifting all following elements. | |
| void | RemoveAtAndSwap (ezUInt32 uiIndex, ezUInt32 uiNumElements=1) |
| Removes the element at index and fills the gap by swapping in the last element. | |
| ezUInt32 | IndexOf (const T &value, ezUInt32 uiStartIndex=0) const |
| Searches for the first occurrence of the given value and returns its index or ezInvalidIndex if not found. | |
| ezUInt32 | LastIndexOf (const T &value, ezUInt32 uiStartIndex=ezInvalidIndex) const |
| Searches for the last occurrence of the given value and returns its index or ezInvalidIndex if not found. | |
| T & | ExpandAndGetRef () |
| Grows the array by one element and returns a reference to the newly created element. | |
| T * | ExpandBy (ezUInt32 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 | PushBack (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 | PushBackUnchecked (T &&value) |
| Pushes value at the end of the array. Does NOT ensure capacity. | |
| void | PushBackRange (const ezArrayPtr< const T > &range) |
| Pushes all elements in range at the end of the array. Increases the capacity if necessary. | |
| void | PopBack (ezUInt32 uiCountToRemove=1) |
| Removes count elements from the end of the array. | |
| T & | PeekBack () |
| Returns the last element of the array. | |
| const T & | PeekBack () const |
| Returns the last element of the array. | |
| void | Sort (const Comparer &comparer) |
| Sort with explicit comparer. | |
| void | Sort () |
| Sort with default comparer. | |
| T * | GetData () |
| Returns a pointer to the array data, or nullptr if the array is empty. | |
| const T * | GetData () const |
| Returns a pointer to the array data, or nullptr if the array is empty. | |
| ezArrayPtr< T > | GetArrayPtr () |
| Returns an array pointer to the array data, or an empty array pointer if the array is empty. | |
| ezArrayPtr< const T > | GetArrayPtr () const |
| Returns an array pointer to the array data, or an empty array pointer if the array is empty. | |
| ezArrayPtr< typename ezArrayPtr< T >::ByteType > | GetByteArrayPtr () |
| Returns a byte array pointer to the array data, or an empty array pointer if the array is empty. | |
| ezArrayPtr< typename ezArrayPtr< const T >::ByteType > | GetByteArrayPtr () const |
| Returns a byte array pointer to the array data, or an empty array pointer if the array is empty. | |
| ezUInt32 | GetCapacity () const |
| Returns the reserved number of elements that the array can hold without reallocating. | |
Additional Inherited Members | |
Public Types inherited from ezArrayBase< T, ezDynamicArrayBase< T > > | |
| using | const_iterator = const T * |
| using | const_reverse_iterator = const_reverse_pointer_iterator< T > |
| using | iterator = T * |
| using | reverse_iterator = reverse_pointer_iterator< T > |
Protected Member Functions inherited from ezHybridArray< T, Size, AllocatorWrapper > | |
| EZ_ALWAYS_INLINE T * | GetStaticArray () |
| EZ_ALWAYS_INLINE const T * | GetStaticArray () const |
Protected Member Functions inherited from ezDynamicArray< T, AllocatorWrapper > | |
| ezDynamicArray (T *pInplaceStorage, ezUInt32 uiCapacity, ezAllocator *pAllocator) | |
Protected Member Functions inherited from ezDynamicArrayBase< T > | |
| ezDynamicArrayBase (ezAllocator *pAllocator) | |
| Creates an empty array. Does not allocate any data yet. | |
| ezDynamicArrayBase (T *pInplaceStorage, ezUInt32 uiCapacity, ezAllocator *pAllocator) | |
| ezDynamicArrayBase (const ezDynamicArrayBase< T > &other, ezAllocator *pAllocator) | |
| Creates a copy of the given array. | |
| ezDynamicArrayBase (ezDynamicArrayBase< T > &&other, ezAllocator *pAllocator) | |
| Moves the given array into this one. | |
| ezDynamicArrayBase (const ezArrayPtr< const T > &other, ezAllocator *pAllocator) | |
| Creates a copy of the given array. | |
| ~ezDynamicArrayBase () | |
| Destructor. | |
| void | operator= (const ezDynamicArrayBase< T > &rhs) |
| Copies the data from some other contiguous array into this one. | |
| void | operator= (ezDynamicArrayBase< 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 ezArrayBase< T, ezDynamicArrayBase< T > > | |
| void | DoSwap (ezArrayBase< T, ezDynamicArrayBase< T > > &other) |
Protected Attributes inherited from ezArrayBase< T, ezDynamicArrayBase< T > > | |
| T * | m_pElements |
| Element-type access to m_Data. | |
| ezUInt32 | m_uiCount |
| The number of elements used from the array. | |
| ezUInt32 | 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 temp allocator is optimized for short-lived allocations and can be more efficient than the default allocator for this use case.