Class ChunkedArray
Template for dynamic array with variable capacity that uses fixed size memory chunks for data storage rather than linear allocation.
Array with variable capacity that does not moves elements when it grows so you can add item and use pointer to it while still keep adding new items.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Core/Collections/ChunkedArray.h
Syntax
public class ChunkedArray<T, ChunkSize>
Type Parameters
T
|
ChunkSize
|
Constructors
~ChunkedArray()
Declaration
public ~ChunkedArray()
ChunkedArray()
Declaration
public ChunkedArray()
Methods
Add(const T& item)
Adds the specified item to the collection.
Declaration
public T* Add(const T& item)
Parameters
T
item
The item. |
Returns
T
The pointer to the allocated item in the storage. |
AddOne()
Adds the one item to the collection and returns the reference to it.
Declaration
public T AddOne()
Returns
T
The reference to the added item. |
At(int32 index)
Declaration
public T At(int32 index) const
Parameters
int32
index
|
Returns
T
|
Begin()
Declaration
public Iterator Begin() const
Returns
Iterator
|
begin()
Declaration
public Iterator begin()
Returns
Iterator
|
Capacity()
Gets the amount of the elements that can be hold by collection without resizing.
Declaration
public int32 Capacity() const
Returns
int32
|
Clear()
Clears the collection but without changing its capacity.
Declaration
public void Clear()
Count()
Gets the amount of the elements in the collection.
Declaration
public int32 Count() const
Returns
int32
|
End()
Declaration
public Iterator End() const
Returns
Iterator
|
end()
Declaration
public Iterator end()
Returns
Iterator
|
EnsureCapacity(int32 minCapacity)
Ensures that collection has a given capacity. It does not preserve collection contents.
Declaration
public void EnsureCapacity(int32 minCapacity)
Parameters
int32
minCapacity
The minimum required capacity. |
Find(const T& item)
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
Declaration
public int32 Find(const T& item) const
Parameters
T
item
The item to find. |
Returns
int32
The zero-based index of the first occurrence of itm within the entire collection, if found; otherwise, INVALID_INDEX. |
HasItems()
Returns true if array isn't empty.
Declaration
public bool HasItems() const
Returns
bool
|
IsEmpty()
Returns true if collection is empty.
Declaration
public bool IsEmpty() const
Returns
bool
|
IteratorAt(int32 index)
Declaration
public Iterator IteratorAt(int32 index) const
Parameters
int32
index
|
Returns
Iterator
|
operator[](int32 index)
Declaration
public T operator[](int32 index)
Parameters
int32
index
|
Returns
T
|
Release()
Clears the collection and releases the dynamic memory allocated within the container.
Declaration
public void Release()
Remove(const Iterator& i)
Removes the element at specified iterator position.
Declaration
public void Remove(const Iterator& i)
Parameters
Iterator
i
The element iterator to remove. |
Resize(int32 newSize)
Resizes that collection to the specified new size. It may not preserve collection contents in case of shrinking.
Declaration
public void Resize(int32 newSize)
Parameters
int32
newSize
The new size. |