A simple dynamic array of integers.
More...
#include <RecastAlloc.h>
|
| | rcIntArray () |
| | Constructs an instance with an initial array size of zero. More...
|
| |
| | rcIntArray (int n) |
| | Constructs an instance initialized to the specified size. More...
|
| |
| | ~rcIntArray () |
| |
| void | resize (int n) |
| | Specifies the new size of the integer array. More...
|
| |
| void | push (int item) |
| | Push the specified integer onto the end of the array and increases the size by one. More...
|
| |
| int | pop () |
| | Returns the value at the end of the array and reduces the size by one. More...
|
| |
| const int & | operator[] (int i) const |
| | The value at the specified array index. More...
|
| |
| int & | operator[] (int i) |
| | The value at the specified array index. More...
|
| |
| int | size () const |
| | The current size of the integer array. More...
|
| |
A simple dynamic array of integers.
While it is possible to pre-allocate a specific array size during construction or by using the resize method, certain methods will automatically resize the array as needed.
- Warning
- The array memory is not initialized to zero when the size is manually set during construction or when using resize.
| rcIntArray::rcIntArray |
( |
| ) |
|
|
inline |
Constructs an instance with an initial array size of zero.
| rcIntArray::rcIntArray |
( |
int |
n | ) |
|
|
inline |
Constructs an instance initialized to the specified size.
- Parameters
-
| [in] | n | The initial size of the integer array. |
| rcIntArray::~rcIntArray |
( |
| ) |
|
|
inline |
| const int& rcIntArray::operator[] |
( |
int |
i | ) |
const |
|
inline |
The value at the specified array index.
- Warning
- Does not provide overflow protection.
- Parameters
-
| [in] | i | The index of the value. |
| int& rcIntArray::operator[] |
( |
int |
i | ) |
|
|
inline |
The value at the specified array index.
- Warning
- Does not provide overflow protection.
- Parameters
-
| [in] | i | The index of the value. |
Returns the value at the end of the array and reduces the size by one.
- Returns
- The value at the end of the array.
| void rcIntArray::push |
( |
int |
item | ) |
|
|
inline |
Push the specified integer onto the end of the array and increases the size by one.
- Parameters
-
| void rcIntArray::resize |
( |
int |
n | ) |
|
Specifies the new size of the integer array.
- Parameters
-
| [in] | n | The new size of the integer array. |
Using this method ensures the array is at least large enough to hold the specified number of elements. This can improve performance by avoiding auto-resizing during use.
| int rcIntArray::size |
( |
| ) |
const |
|
inline |
The current size of the integer array.
The documentation for this class was generated from the following files: