![]() |
|
Uniot Core
|
| 0.8.1 |
#include <Array.h>
Public Member Functions | |
| Array () | |
| Constructs an empty Array. | |
| Array (size_t capacity) | |
| Constructs an Array with the given capacity, allocating memory. | |
| Array (size_t size, const T *values) | |
| Constructs an Array from an existing C-style array. | |
| Array (const Array &other)=delete | |
| Copy constructor (deleted to prevent accidental copying). | |
| Array (Array &&other) noexcept | |
| Move constructor. | |
| Array & | operator= (const Array &other)=delete |
| Copy assignment operator (deleted to prevent accidental copying). | |
| Array & | operator= (Array &&other) noexcept |
| Move assignment operator. | |
| ~Array () | |
| Destructor that deallocates the array memory. | |
| T & | operator[] (size_t index) |
| Provides access to the array elements without bounds checking. | |
| const T & | operator[] (size_t index) const |
| Provides read-only access to the array elements without bounds checking. | |
| bool | get (size_t index, T &outValue) const |
| Provides access to the array elements with bounds checking. | |
| bool | set (size_t index, const T &value) |
| Sets the value of an element in the array. | |
| size_t | size () const |
| Returns the size of the array. | |
| size_t | capacity () const |
| Returns the capacity of the array. | |
| bool | isEmpty () const |
| Checks if the array is empty. | |
| const T * | raw () const |
| Retrieves a const pointer to the underlying data. | |
| bool | reserve (size_t newCapacity) |
| Reserves memory for at least the specified number of elements. | |
| bool | push (const T &value) |
| Adds a new element to the end of the array using copy semantics. | |
| bool | push (T &&value) |
| Adds a new element to the end of the array using move semantics. | |
| void | clear () |
| Clears the array, setting its size to zero. | |
| bool | shrink () |
| Reduces the capacity to fit the current size. | |
|
inline |
Constructs an empty Array.
|
inline |
Constructs an Array with the given capacity, allocating memory.
| capacity | The number of elements in the array. |
|
inline |
Constructs an Array from an existing C-style array.
| size | The number of elements in the array. |
| values | Pointer to the first element of the array. |
|
delete |
Copy constructor (deleted to prevent accidental copying).
|
inlinenoexcept |
Move constructor.
| other | The Array to move from. |
|
inline |
Destructor that deallocates the array memory.
|
inline |
Returns the capacity of the array.
| size_t | The number of elements that can be stored without reallocating. |
|
inline |
Clears the array, setting its size to zero.
|
inline |
Provides access to the array elements with bounds checking.
| index | The index of the element. |
| outValue | Reference to store the retrieved value. |
| true | The element was retrieved successfully. |
| false | The index is out of bounds. |
|
inline |
Checks if the array is empty.
| true | The array is empty. |
| false | The array contains elements. |
|
inlinenoexcept |
|
delete |
Copy assignment operator (deleted to prevent accidental copying).
|
inline |
Provides access to the array elements without bounds checking.
| index | The index of the element. |
| T& | Reference to the element at the specified index. |
|
inline |
Provides read-only access to the array elements without bounds checking.
| index | The index of the element. |
| T& | Const reference to the element at the specified index. |
|
inline |
Adds a new element to the end of the array using copy semantics.
| value | The value to add. |
| true | The push was successful. |
| false | The push failed (e.g., memory allocation error). |
|
inline |
Adds a new element to the end of the array using move semantics.
| value | The value to add. |
| true | The push was successful. |
| false | The push failed (e.g., memory allocation error). |
|
inline |
Retrieves a const pointer to the underlying data.
| T* | Const pointer to the first element of the array. |
|
inline |
Reserves memory for at least the specified number of elements.
| newCapacity | The desired capacity. |
| true | The reservation was successful. |
| false | The reservation failed (e.g., memory allocation error). |
|
inline |
Sets the value of an element in the array.
| index | The index of the element. |
| value | The value to set. |
| true | The element was set successfully. |
| false | The index is out of bounds. |
|
inline |
Reduces the capacity to fit the current size.
| true | The shrink was successful. |
| false | The shrink failed (e.g., memory allocation error). |
|
inline |
Returns the size of the array.
| size_t | The size of the array. |