17#if (__cplusplus >= 201703L ) || (_MSVC_LANG >= 201703L)
18#define IFCONSTEXPR if constexpr
77 typename std::enable_if<std::is_trivially_destructible<X>::value ==
false>::type
85 typename std::enable_if<std::is_trivially_destructible<X>::value ==
true>::type
93 typename std::enable_if<std::is_trivially_destructible<X>::value ==
false>::type
104 typename std::enable_if<std::is_trivially_destructible<X>::value ==
true>::type
147 this->
data =
nullptr;
162 this->
data[i] = rhs[i];
197 this->
data[i] = rhs[i];
214 this->
data = rhs.data;
215 this->
size = rhs.size;
216 this->
grow = rhs.grow;
218 this->
start = rhs.start;
243 if(this->
size != rhs.
size)
return false;
247 if(!((*
this)[i] == rhs[i] ))
274 if (this->
operator[](i) == e)
300 if (idx < this->
start)
302 for (
IndexT j = 0; j < this->size - i; ++j)
304 this->
data[idx] = this->
data[idx+1];
310 for (
IndexT j = 0; j < i; j++)
312 this->
data[idx] = this->
data[idx-1];
345 TYPE * newdata =
new TYPE[num];
368 if (this->
data !=
nullptr)
378 newdata[i] = std::move(this->
data[idx]);
381 if (this->
data !=
nullptr)
387 this->
data = newdata;
396template<
class TYPE>
void
402 growToSize = this->
grow;
417 growToSize = this->
capacity + growBy;
452 return this->
size == 0;
497 #if __cplusplus > 201703L
498 if constexpr (!std::is_nothrow_destructible_v<TYPE>)
Queue(Queue< TYPE > &&rhs)
move constructor
Definition queue.h:173
void Enqueue(const TYPE &e)
add element to the back of the Dequeue, can trigger grow
Definition queue.h:461
bool Contains(const TYPE &e) const
return true if Dequeue contains element
Definition queue.h:270
void Enqueue(TYPE &&e)
Definition queue.h:476
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type DestroyElement(IndexT idx)
Definition queue.h:86
static const SizeT MinGrowSize
Definition queue.h:114
SizeT capacity
Definition queue.h:119
bool operator!=(const Queue< TYPE > &rhs) const
inequality operator
Definition queue.h:260
bool operator==(const Queue< TYPE > &rhs) const
equality operator
Definition queue.h:241
SizeT size
Definition queue.h:118
void Clear()
remove all elements from the Dequeue
Definition queue.h:326
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==true >::type ClearAll()
Definition queue.h:105
void Grow()
grow Dequeue by internal growing rules (slow)
Definition queue.h:397
~Queue()
destructor
Definition queue.h:140
void operator=(Queue< TYPE > &&rhs)
move assignment operator
Definition queue.h:210
Queue()
constructor
Definition queue.h:126
Queue(const Queue< TYPE > &rhs)
copy constructor
Definition queue.h:155
SizeT Capacity() const
returns allocation of elements in the Dequeue
Definition queue.h:439
void EraseIndex(const IndexT i)
erase element at index (slow!!)
Definition queue.h:285
bool IsEmpty() const
return true if Dequeue is empty
Definition queue.h:450
TYPE * data
Definition queue.h:112
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type DestroyElement(IndexT idx)
Definition queue.h:78
void operator=(const Queue< TYPE > &rhs)
assignment operator
Definition queue.h:190
__forceinline std::enable_if< std::is_trivially_destructible< X >::value==false >::type ClearAll()
Definition queue.h:94
SizeT grow
Definition queue.h:116
static const SizeT MaxGrowSize
Definition queue.h:115
void Reserve(SizeT num)
increase capacity to fit N more elements into the Dequeue (slow)
Definition queue.h:338
TYPE & Peek() const
access to element at front of Dequeue without removing it
Definition queue.h:516
SizeT start
Definition queue.h:117
TYPE Dequeue()
remove the element from the front of the Dequeue
Definition queue.h:492
IndexT MapIndex(IndexT index) const
maps index to actual item position using wrapping
Definition queue.h:531
TYPE & operator[](IndexT index) const
access element by index, 0 is the frontmost element (next to be dequeued)
Definition queue.h:230
SizeT Size() const
returns number of elements in the Dequeue
Definition queue.h:428
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 pinned array is an array which manages its own virtual memory.
Definition String.cs:6
bool operator==(const String &a, const String &b)
Definition string.cc:830
#define IFCONSTEXPR
Definition queue.h:20
Nebula's scalar datatype.
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48