71 typename std::enable_if<std::is_trivially_destructible<X>::value ==
false>::type
79 typename std::enable_if<std::is_trivially_destructible<X>::value ==
true>::type
87 typename std::enable_if<std::is_trivially_destructible<X>::value ==
false>::type
98 typename std::enable_if<std::is_trivially_destructible<X>::value ==
true>::type
139 ::operator
delete[](this->
data);
141 this->
data =
nullptr;
159 ::new ((
void*)&this->
data[i]) TYPE(rhs[i]);
195 ::new ((
void*)&this->
data[i]) TYPE(rhs[i]);
215 ::operator
delete[](this->
data);
217 this->
data = rhs.data;
218 this->
size = rhs.size;
219 this->
grow = rhs.grow;
221 this->
start = rhs.start;
247 if(this->
size != rhs.
size)
return false;
251 if(!((*
this)[i] == rhs[i] ))
278 if (this->
operator[](i) == e)
301 if constexpr(std::is_trivially_copyable_v<TYPE>)
305 if (idx < this->
start)
307 for (
IndexT j = 0; j < this->size - i - 1; ++j)
309 this->
data[idx] = this->
data[idx + 1];
315 for (
IndexT j = 0; j < i; j++)
317 this->
data[idx] = this->
data[idx - 1];
330 if (idx < this->
start)
332 SizeT remaining = this->size - i - 1;
335 ::new ((
void*)&this->
data[idx]) TYPE(std::move(this->
data[idx + 1]));
337 for (
IndexT j = 1; j < remaining; ++j)
339 this->
data[idx] = std::move(this->
data[idx + 1]);
342 this->
data[idx].~TYPE();
347 ::new ((
void*)&this->
data[idx]) TYPE(std::move(this->
data[idx - 1]));
349 for (
IndexT j = 1; j < i; ++j)
351 this->
data[idx] = std::move(this->
data[idx - 1]);
354 this->
data[idx].~TYPE();
386 TYPE * newdata = (TYPE*)::operator
new[](num *
sizeof(TYPE));
392 if constexpr(std::is_trivially_copyable_v<TYPE>)
409 if (this->
data !=
nullptr)
411 ::operator
delete[](this->
data);
420 ::new ((
void*)&newdata[i]) TYPE(std::move(this->
data[idx]));
423 if (this->
data !=
nullptr)
425 ::operator
delete[](this->
data);
429 this->
data = newdata;
438template<
class TYPE>
void
444 growToSize = this->
grow;
459 growToSize = this->
capacity + growBy;
494 return this->
size == 0;
525 ::new ((
void*)&this->
data[this->
MapIndex(this->
size++)]) TYPE(std::move(e));
538 TYPE t = std::move(this->
data[this->
start]);
void Enqueue(const TYPE &e)
add element to the back of the Dequeue, can trigger grow
Definition queue.h:503
bool Contains(const TYPE &e) const
return true if Dequeue contains element
Definition queue.h:274
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type DestroyElement(IndexT idx)
Definition queue.h:80
static const SizeT MinGrowSize
Definition queue.h:108
SizeT capacity
Definition queue.h:113
bool operator!=(const Queue< TYPE > &rhs) const
inequality operator
Definition queue.h:264
bool operator==(const Queue< TYPE > &rhs) const
equality operator
Definition queue.h:245
SizeT size
Definition queue.h:112
void Clear()
remove all elements from the Dequeue
Definition queue.h:367
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type ClearAll()
Definition queue.h:99
void Grow()
grow Dequeue by internal growing rules (slow)
Definition queue.h:439
~Queue()
destructor
Definition queue.h:134
Queue()
constructor
Definition queue.h:120
SizeT Capacity() const
returns allocation of elements in the Dequeue
Definition queue.h:481
void EraseIndex(const IndexT i)
erase element at index (slow!!)
Definition queue.h:289
bool IsEmpty() const
return true if Dequeue is empty
Definition queue.h:492
TYPE * data
Definition queue.h:106
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type DestroyElement(IndexT idx)
Definition queue.h:72
void operator=(const Queue< TYPE > &rhs)
assignment operator
Definition queue.h:187
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type ClearAll()
Definition queue.h:88
SizeT grow
Definition queue.h:110
static const SizeT MaxGrowSize
Definition queue.h:109
void Reserve(SizeT num)
increase capacity to fit N more elements into the Dequeue (slow)
Definition queue.h:379
TYPE & Peek() const
access to element at front of Dequeue without removing it
Definition queue.h:551
SizeT start
Definition queue.h:111
TYPE Dequeue()
remove the element from the front of the Dequeue
Definition queue.h:534
IndexT MapIndex(IndexT index) const
maps index to actual item position using wrapping
Definition queue.h:566
TYPE & operator[](IndexT index) const
access element by index, 0 is the frontmost element (next to be dequeued)
Definition queue.h:234
SizeT Size() const
returns number of elements in the Dequeue
Definition queue.h:470
static uint RoundUp(uint val, uint boundary)
generic roundup
Definition round.h:83
#define n_assert(exp)
Definition debug.h:50
void Copy(const void *from, void *to, size_t numBytes)
Copy a chunk of memory (note the argument order is different from memcpy()!
Definition osxmemory.cc:213
A quad tree designed to return regions of free 2D space.
Definition String.cs:6
bool operator==(const String &a, const String &b)
Definition string.cc:848
Nebula's scalar datatype.
int SizeT
Definition types.h:42
int IndexT
Definition types.h:41