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]; }
121 inline operator T*() {
return ptr; }
rcIntArray(int n)
Definition: RecastAlloc.h:74
int & operator[](int i)
Definition: RecastAlloc.h:97
int size() const
The current size of the integer array.
Definition: RecastAlloc.h:100
int m_size
Definition: RecastAlloc.h:64
rcAllocHint
Definition: RecastAlloc.h:24
Definition: RecastAlloc.h:105
T * ptr
Definition: RecastAlloc.h:107
int * m_data
Definition: RecastAlloc.h:63
void rcFree(void *ptr)
Definition: RecastAlloc.cpp:55
int m_cap
Definition: RecastAlloc.h:64
void * rcAlloc(int size, rcAllocHint hint)
Definition: RecastAlloc.cpp:44
rcIntArray & operator=(const rcIntArray &)
int pop()
Definition: RecastAlloc.h:87
void *( rcAllocFunc)(int size, rcAllocHint hint)
A memory allocation function.
Definition: RecastAlloc.h:35
const int & operator[](int i) const
Definition: RecastAlloc.h:92
Memory will persist after a function call.
Definition: RecastAlloc.h:26
~rcIntArray()
Definition: RecastAlloc.h:75
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
Definition: RecastAlloc.cpp:37
rcScopedDelete()
Constructs an instance with a null pointer.
Definition: RecastAlloc.h:112
rcScopedDelete(T *p)
Definition: RecastAlloc.h:116
Memory used temporarily within a function.
Definition: RecastAlloc.h:27
void( rcFreeFunc)(void *ptr)
Definition: RecastAlloc.h:40
rcIntArray()
Constructs an instance with an initial array size of zero.
Definition: RecastAlloc.h:70
void resize(int n)
Definition: RecastAlloc.cpp:75
void push(int item)
Definition: RecastAlloc.h:83
A simple dynamic array of integers.
Definition: RecastAlloc.h:61
~rcScopedDelete()
Definition: RecastAlloc.h:117