19 #ifndef B2_GROWABLE_STACK_H
20 #define B2_GROWABLE_STACK_H
27 template <
typename T,
int32 N>
40 if (m_stack != m_array)
47 void Push(
const T& element)
49 if (m_count == m_capacity)
53 m_stack = (T*)
b2Alloc(m_capacity *
sizeof(T));
54 memcpy(m_stack, old, m_count *
sizeof(T));
61 m_stack[m_count] = element;
67 b2Assert(m_count > 0);
69 return m_stack[m_count];
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition: b2Settings.cpp:32
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition: b2Settings.cpp:27
Definition: b2GrowableStack.h:28