83 inline void push(
int item) {
resize(m_size+1); m_data[m_size-1] = item; }
87 inline int pop() {
if (m_size > 0) m_size--;
return m_data[m_size]; }
92 inline const int&
operator[](
int i)
const {
return m_data[i]; }
100 inline int size()
const {
return m_size; }
108 inline T* operator=(T* p);
121 inline operator T*() {
return ptr; }
rcIntArray(int n)
Constructs an instance initialized to the specified size.
Definition: RecastAlloc.h:74
void *( rcAllocFunc)(size_t size, rcAllocHint hint)
A memory allocation function.
Definition: RecastAlloc.h:35
int & operator[](int i)
The value at the specified array index.
Definition: RecastAlloc.h:97
int size() const
The current size of the integer array.
Definition: RecastAlloc.h:100
rcAllocHint
Provides hint values to the memory allocator on how long the memory is expected to be used...
Definition: RecastAlloc.h:24
A simple helper class used to delete an array when it goes out of scope.
Definition: RecastAlloc.h:105
void rcFree(void *ptr)
Deallocates a memory block.
Definition: RecastAlloc.cpp:55
int pop()
Returns the value at the end of the array and reduces the size by one.
Definition: RecastAlloc.h:87
const int & operator[](int i) const
The value at the specified array index.
Definition: RecastAlloc.h:92
Memory will persist after a function call.
Definition: RecastAlloc.h:26
void * rcAlloc(size_t size, rcAllocHint hint)
Allocates a memory block.
Definition: RecastAlloc.cpp:44
~rcIntArray()
Definition: RecastAlloc.h:75
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
Sets the base custom allocation functions to be used by Recast.
Definition: RecastAlloc.cpp:37
rcScopedDelete()
Constructs an instance with a null pointer.
Definition: RecastAlloc.h:112
rcScopedDelete(T *p)
Constructs an instance with the specified pointer.
Definition: RecastAlloc.h:116
Memory used temporarily within a function.
Definition: RecastAlloc.h:27
rcIntArray()
Constructs an instance with an initial array size of zero.
Definition: RecastAlloc.h:70
void( rcFreeFunc)(void *ptr)
A memory deallocation function.
Definition: RecastAlloc.h:40
void resize(int n)
Specifies the new size of the integer array.
Definition: RecastAlloc.cpp:75
void push(int item)
Push the specified integer onto the end of the array and increases the size by one.
Definition: RecastAlloc.h:83
A simple dynamic array of integers.
Definition: RecastAlloc.h:61
~rcScopedDelete()
Definition: RecastAlloc.h:117