18 #ifndef B2_STACK_QUEUE
19 #define B2_STACK_QUEUE
21 #include <Box2D/Common/b2StackAllocator.h>
31 m_allocator = allocator;
32 m_buffer = (T*) m_allocator->Allocate(
sizeof(T) * capacity);
35 m_capacity = capacity;
40 m_allocator->Free(m_buffer);
43 void Push(
const T &item)
45 if (m_back >= m_capacity)
47 for (int32 i = m_front; i < m_back; i++)
49 m_buffer[i - m_front] = m_buffer[i];
53 if (m_back >= m_capacity)
63 m_buffer = (T*) m_allocator->Reallocate(m_buffer,
64 sizeof(T) * m_capacity);
67 m_buffer[m_back] = item;
73 b2Assert(m_front < m_back);
79 b2Assert(m_front <= m_back);
80 return m_front == m_back;
83 const T &Front()
const
85 return m_buffer[m_front];
Definition: b2StackAllocator.h:37
Definition: b2StackQueue.h:24