ezEngine  Milestone 7
ezHybridArray< T, Size, AllocatorWrapper > Class Template Reference

#include <HybridArray.h>

Inheritance diagram for ezHybridArray< T, Size, AllocatorWrapper >:

Public Member Functions

 ezHybridArray (ezAllocatorBase *pAllocator)
 
 ezHybridArray (const ezHybridArray< T, Size, AllocatorWrapper > &other)
 
 ezHybridArray (const ezHybridArrayBase< T, Size > &other)
 
 ezHybridArray (const ezArrayPtr< const T > &other)
 
 ezHybridArray (ezHybridArray< T, Size, AllocatorWrapper > &&other)
 
 ezHybridArray (ezHybridArrayBase< T, Size > &&other)
 
void operator= (const ezHybridArray< T, Size, AllocatorWrapper > &rhs)
 
void operator= (const ezHybridArrayBase< T, Size > &rhs)
 
void operator= (const ezArrayPtr< const T > &rhs)
 
void operator= (ezHybridArray< T, Size, AllocatorWrapper > &&rhs)
 
void operator= (ezHybridArrayBase< T, Size > &&rhs)
 
- Public Member Functions inherited from ezHybridArrayBase< T, Size >
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.
 
ezAllocatorBaseGetAllocator () 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.
 
- Public Member Functions inherited from ezArrayBase< T, ezHybridArrayBase< T, Size > >
 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 ezArrayPtr< const 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 SetCountUninitialized (ezUInt32 uiCount)
 Resizes the array to have exactly uiCount elements. Extra elements might be uninitialized.
 
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 Insert (const T &value, ezUInt32 uiIndex)
 Inserts value at index by shifting all following elements.
 
void Insert (T &&value, ezUInt32 uiIndex)
 Inserts value at index by shifting all following elements.
 
bool Remove (const T &value)
 Removes the first occurrence of value and fills the gap by shifting all following elements.
 
bool RemoveSwap (const T &value)
 Removes the first occurrence of value and fills the gap by swapping in the last element.
 
void RemoveAt (ezUInt32 uiIndex)
 Removes the element at index and fills the gap by shifting all following elements.
 
void RemoveAtSwap (ezUInt32 uiIndex)
 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.
 
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 a array pointer to the array data, or an empty array pointer if the array is empty.
 
ezArrayPtr< const T > GetArrayPtr () const
 Returns a array pointer to the array data, or an empty array pointer if the array is empty.
 

Additional Inherited Members

- Public Types inherited from ezArrayBase< T, ezHybridArrayBase< T, Size > >
typedef T const * const_iterator
 
typedef
const_reverse_pointer_iterator
< T > 
const_reverse_iterator
 
typedef T * iterator
 
typedef
reverse_pointer_iterator< T > 
reverse_iterator
 
- Public Attributes inherited from ezHybridArrayBase< T, Size >
ezUInt8 m_StaticData [Size *sizeof(T)]
 
- Protected Member Functions inherited from ezHybridArrayBase< T, Size >
 ezHybridArrayBase (ezAllocatorBase *pAllocator)
 Creates an empty array. Does not allocate any data yet.
 
 ezHybridArrayBase (const ezHybridArrayBase< T, Size > &other, ezAllocatorBase *pAllocator)
 Creates a copy of the given array.
 
 ezHybridArrayBase (ezHybridArrayBase< T, Size > &&other, ezAllocatorBase *pAllocator)
 Moves the given array.
 
 ezHybridArrayBase (const ezArrayPtr< const T > &other, ezAllocatorBase *pAllocator)
 Creates a copy of the given array.
 
 ~ezHybridArrayBase ()
 Destructor.
 
void operator= (const ezHybridArrayBase< T, Size > &rhs)
 Copies the data from some other contiguous array into this one.
 
void operator= (ezHybridArrayBase< T, Size > &&rhs)
 Moves the data from some other contiguous array into this one.
 
- Protected Attributes inherited from ezArrayBase< T, ezHybridArrayBase< T, Size > >
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.
 

Detailed Description

template<typename T, ezUInt32 Size, typename AllocatorWrapper = ezDefaultAllocatorWrapper>
class ezHybridArray< T, Size, AllocatorWrapper >

See Also
ezHybridArrayBase

The documentation for this class was generated from the following files: