Class BitArray
Template for dynamic array with variable capacity that stores the bit values.
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Core/Collections/BitArray.h
Syntax
public class BitArray<AllocationType>
Type Parameters
|
AllocationType
|
Constructors
~BitArray()
BitArray(const BitArray& other)
Initializes BitArray by copying the elements from the other collection.
Declaration
public BitArray(const BitArray& other) noexcept
Parameters
|
BitArray
other
The other collection to copy. |
BitArray(const BitArray<OtherAllocationType>& other)
Initializes a new instance of the BitArray class.
Declaration
public BitArray(const BitArray<OtherAllocationType>& other) noexcept
Parameters
|
BitArray<OtherAllocationType>
other
The other collection to copy. |
Type Parameters
|
typename OtherAllocationType
|
BitArray(const int32 capacity)
Initializes BitArray by reserving space.
Declaration
public BitArray(const int32 capacity)
Parameters
|
int32
capacity
The number of elements that can be added without a need to allocate more memory. |
Methods
Add(const BitArray& other)
Adds the other collection to the collection.
Declaration
public void Add(const BitArray& other)
Parameters
|
BitArray
other
The other collection to add. |
Add(const bool item)
Adds the specified item to the collection.
Declaration
public void Add(const bool item)
Parameters
|
bool
item
The item to add. |
Add(const bool* items, const int32 count)
Adds the specified item to the collection.
Declaration
public void Add(const bool* items, const int32 count)
Parameters
|
bool
items
The items to add. |
|
int32
count
The items count. |
BitArray()
Initializes an empty BitArray without reserving any space.
Declaration
public BitArray()
Returns
|
FORCE_INLINE
|
BitArray(BitArray&& other)
Initializes a new instance of the BitArray class.
Declaration
public BitArray(BitArray&& other) noexcept
Parameters
|
BitArray
other
The other collection to move. |
Returns
|
FORCE_INLINE
|
Capacity()
Gets the amount of the items that can be contained by collection without resizing.
Declaration
public int32 Capacity() const
Returns
|
int32
|
Clear()
Clear the collection without changing its capacity.
Declaration
public void Clear()
Returns
|
void
|
Count()
Gets the amount of the items in the collection.
Declaration
public int32 Count() const
Returns
|
int32
|
EnsureCapacity(const int32 minCapacity, const bool preserveContents=true)
Ensures the collection has given capacity (or more).
Declaration
public void EnsureCapacity(const int32 minCapacity, const bool preserveContents=true)
Parameters
|
int32
minCapacity
The minimum capacity. |
|
bool
preserveContents
True if preserve collection data when changing its size, otherwise collection after resize will be empty. |
Get()
Gets the pointer to the bits storage data (linear allocation).
Declaration
public ItemType* Get()
Returns
|
ItemType
|
Get(const int32 index)
Gets the item at the given index.
Declaration
public bool Get(const int32 index) const
Parameters
|
int32
index
The index of the item. |
Returns
|
bool
The value of the item. |
HasItems()
Returns true if collection isn't empty.
Declaration
public bool HasItems() const
Returns
|
bool
|
IsEmpty()
Returns true if collection is empty.
Declaration
public bool IsEmpty() const
Returns
|
bool
|
operator!=(const BitArray<OtherAllocationType>& other)
Declaration
public bool operator!=(const BitArray<OtherAllocationType>& other) const
Parameters
|
BitArray<OtherAllocationType>
other
|
Returns
|
bool
|
Type Parameters
|
typename OtherAllocationType
|
operator[](const int32 index)
Gets the item at the given index.
Declaration
public bool operator[](const int32 index) const
Parameters
|
int32
index
The index of the item. |
Returns
|
bool
The value of the item. |
operator=(BitArray&& other)
The move assignment operator that deletes the current collection of items and the moves items from the other array.
Declaration
public BitArray operator=(BitArray&& other) noexcept
Parameters
|
BitArray
other
The other collection to move. |
Returns
|
BitArray
The reference to this. |
operator=(const BitArray& other)
The assignment operator that deletes the current collection of items and the copies items from the other array.
Declaration
public BitArray operator=(const BitArray& other) noexcept
Parameters
|
BitArray
other
The other collection to copy. |
Returns
|
BitArray
The reference to this. |
operator==(const BitArray<OtherAllocationType>& other)
Declaration
public bool operator==(const BitArray<OtherAllocationType>& other) const
Parameters
|
BitArray<OtherAllocationType>
other
|
Returns
|
bool
|
Type Parameters
|
typename OtherAllocationType
|
Resize(const int32 size, const bool preserveContents=true)
Resizes the collection to the specified size. If the size is equal or less to the current capacity no additional memory reallocation in performed.
Declaration
public void Resize(const int32 size, const bool preserveContents=true)
Parameters
|
int32
size
The new collection size. |
|
bool
preserveContents
True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data. |
Set(const int32 index, const bool value)
Sets the item at the given index.
Declaration
public void Set(const int32 index, const bool value)
Parameters
|
int32
index
The index of the item. |
|
bool
value
The value to set. |
SetAll(const bool value)
Sets all items to the given value
Declaration
public void SetAll(const bool value)
Parameters
|
bool
value
The value to assign to all the collection items. |
SetCapacity(const int32 capacity, const bool preserveContents=true)
Changes the capacity of the collection.
Declaration
public void SetCapacity(const int32 capacity, const bool preserveContents=true)
Parameters
|
int32
capacity
The new capacity. |
|
bool
preserveContents
True if preserve collection data when changing its size, otherwise collection after resize will be empty. |
Swap(BitArray& other)
Swaps the contents of collection with the other object without copy operation. Performs fast internal data exchange.
Declaration
public void Swap(BitArray& other)
Parameters
|
BitArray
other
The other collection. |