Beef Corlib
Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
System.Collections.Queue< T > Class Template Reference

A simple Queue of generic items. More...

Inheritance diagram for System.Collections.Queue< T >:
System.Collections.IEnumerable< T >

Classes

struct  Enumerator
 Implements an enumerator for a Queue. More...
 

Public Member Functions

 Queue ()
 Creates a queue with room for capacity objects. More...
 
 Queue (int capacity)
 Creates a queue with room for capacity objects. More...
 
 Queue (IEnumerator< T > enumerator)
 
void Clear ()
 Removes all items from the queue.
 
void CopyTo (Span< T > span)
 CopyTo copies a collection into an Array, starting at a particular index into the array.
 
void Enqueue (T item)
 Adds item to the tail of the queue.
 
void Add (T item)
 Adds item to the tail of the queue.
 
void AddFront (T item)
 Adds item to the head of the queue.
 
Enumerator GetEnumerator ()
 GetEnumerator returns an enumerator over this Queue which supports removing.
 
Dequeue ()
 Removes the object at the head of the queue and returns it. More...
 
Result< T > TryPopFront ()
 Removes the object at the head of the queue and returns it. More...
 
PopFront ()
 Removes the object at the head of the queue and returns it. More...
 
Result< T > TryPopBack ()
 Removes the object at the tail of the queue and returns it. More...
 
PopBack ()
 Removes the object at the tail of the queue and returns it. More...
 
Result< T > TryPeek ()
 Returns the object at the head of the queue. More...
 
Peek ()
 Returns the object at the head of the queue. More...
 
bool Contains (T item)
 Returns true if the queue contains at least one object equal to 'item'.
 
bool ContainsStrict (T item)
 Returns true if the queue contains at least one object equal to 'item'.
 
void RemoveAt (int index)
 
void TrimExcess ()
 

Protected Member Functions

virtual T * Alloc (int size)
 
virtual void Free (T *val)
 
override void GCMarkMembers ()
 

Properties

ref T this[int index] [get, set]
 
ref T this[Index index] [get, set]
 
ref T Front [get]
 
ref T Back [get]
 
int AllocSize [get]
 
bool IsDynAlloc [get]
 
int Count [get]
 
bool IsEmpty [get]
 

Detailed Description

A simple Queue of generic items.

Internally it is implemented as a circular buffer, so Enqueue can be O(n). Dequeue is O(1).

Constructor & Destructor Documentation

◆ Queue() [1/2]

Creates a queue with room for capacity objects.

The default initial capacity and grow factor are used.

◆ Queue() [2/2]

System.Collections.Queue< T >.Queue ( int  capacity)
inline

Creates a queue with room for capacity objects.

The default grow factor is used.

Member Function Documentation

◆ Dequeue()

T System.Collections.Queue< T >.Dequeue ( )
inline

Removes the object at the head of the queue and returns it.

If the queue is empty, this method returns an error

◆ Peek()

T System.Collections.Queue< T >.Peek ( )
inline

Returns the object at the head of the queue.

The object remains in the queue. If the queue is empty, this method fails

◆ PopBack()

T System.Collections.Queue< T >.PopBack ( )
inline

Removes the object at the tail of the queue and returns it.

If the queue is empty, this method fails

◆ PopFront()

T System.Collections.Queue< T >.PopFront ( )
inline

Removes the object at the head of the queue and returns it.

If the queue is empty, this method fails

◆ TryPeek()

Result<T> System.Collections.Queue< T >.TryPeek ( )
inline

Returns the object at the head of the queue.

The object remains in the queue. If the queue is empty, this method returns an error

◆ TryPopBack()

Result<T> System.Collections.Queue< T >.TryPopBack ( )
inline

Removes the object at the tail of the queue and returns it.

If the queue is empty, this method returns an error

◆ TryPopFront()

Result<T> System.Collections.Queue< T >.TryPopFront ( )
inline

Removes the object at the head of the queue and returns it.

If the queue is empty, this method returns an error