30 int firstEnd = head + num;\
32 if (firstEnd > numAllocated) {\
33 secondEnd = firstEnd - numAllocated;\
34 firstEnd = numAllocated;\
86 for (
int i = head; i < firstEnd; ++i) {
87 new (data + i)T(other.
data[i]);
90 for (
int i = 0; i < secondEnd; ++i) {
91 new (data + i)T(other.
data[i]);
116 for (
int i = head; i < firstEnd; ++i, ++j) {
117 new (data + j)T(old[i]);
121 for (
int i = 0; i < secondEnd; ++i, ++j) {
122 new (data + j)T(old[i]);
128 numAllocated = newSize;
137 if (num == numAllocated) {
215 int tail =
index(num - 1);
216 T result(data[tail]);
229 T result(data[head]);
232 head = (head + 1) % numAllocated;
253 void clear(
bool freeStorage =
true) {
259 for (i = head; i < firstEnd; ++i) {
263 for (i = 0; i < secondEnd; ++i) {
309 return data[
index(n)];
317 return data[
index(n)];
323 return (*
this)[
size() - 1];
327 return (*
this)[
size() - 1];
338 for (
int i = 0; i <
size(); ++i) {
339 if ((*
this)[i] == e) {
355 for (i = 0; i < secondEnd; ++i) {
359 for (i = head; i < firstEnd; ++i) {
void enqueue(const T &e)
Definition: Queue.h:205
void reserveSpace()
Definition: Queue.h:136
bool empty() const
Definition: Queue.h:330
void fastClear()
Definition: Queue.h:277
#define FIND_ENDS
Definition: Queue.h:29
int size() const
Definition: Queue.h:293
arena_t NULL
Definition: jemalloc_internal.h:624
T * data
Definition: Queue.h:58
T & last()
Definition: Queue.h:326
void pushBack(const T &e)
Definition: Queue.h:191
virtual ~Queue()
Definition: Queue.h:166
int length() const
Definition: Queue.h:300
void repackAndRealloc(int newSize)
Definition: Queue.h:107
static void * malloc(size_t bytes)
Definition: System.cpp:1441
const T & last() const
Definition: Queue.h:322
T & operator[](int n)
Definition: Queue.h:307
void clear(bool freeStorage=true)
Definition: Queue.h:253
void deleteAll()
Definition: Queue.h:351
T popFront()
Definition: Queue.h:228
int numAllocated
Definition: Queue.h:73
#define debugAssert(exp)
Definition: debugAssert.h:160
void pushFront(const T &e)
Definition: Queue.h:174
void _copy(const Queue &other)
Definition: Queue.h:76
static void free(void *p)
Definition: System.cpp:1473
Queue()
Definition: Queue.h:144
bool contains(const T &e) const
Definition: Queue.h:337
const T & operator[](int n) const
Definition: Queue.h:315
Queue & operator=(const Queue &other)
Definition: Queue.h:284
Queue(const Queue &other)
Definition: Queue.h:155
int num
Definition: Queue.h:68
int index(int i) const
Definition: Queue.h:100
T dequeue()
Definition: Queue.h:241
T popBack()
Definition: Queue.h:214
int head
Definition: Queue.h:63