23#ifndef B2_GROWABLE_STACK_H
24#define B2_GROWABLE_STACK_H
33template <
typename T,
int32 N>
46 if (m_stack != m_array)
53 void Push(
const T& element)
55 if (m_count == m_capacity)
59 m_stack = (T*)
b2Alloc(m_capacity *
sizeof(T));
60 memcpy(m_stack, old, m_count *
sizeof(T));
67 m_stack[m_count] = element;
73 b2Assert(m_count > 0);
75 return m_stack[m_count];
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition b2_settings.h:106
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition b2_settings.h:100
Definition b2_growable_stack.h:35