19 #ifndef B2_GROWABLE_STACK_H
20 #define B2_GROWABLE_STACK_H
29 template <
typename T,
int32 N>
42 if (m_stack != m_array)
49 void Push(
const T& element)
51 if (m_count == m_capacity)
55 m_stack = (T*)
b2Alloc(m_capacity *
sizeof(T));
56 memcpy(m_stack, old, m_count *
sizeof(T));
63 m_stack[m_count] = element;
69 b2Assert(m_count > 0);
71 return m_stack[m_count];
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition: b2Settings.cpp:99
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition: b2Settings.cpp:93
Definition: b2GrowableStack.h:30