SimpleCxxLib
packageclass Queue<ValueType>
Constructor | |
Initializes a new empty queue. | |
Methods | |
Removes all elements from the queue. | |
Removes and returns the first item in the queue. | |
Adds value to the end of the queue. | |
Returns true if the queue contains no elements. | |
Returns the first value in the queue, without removing it. | |
Returns the number of values in the queue. | |
Converts the queue to a printable string representation. |
Queue();
Usage:
Queue<ValueType> queue; Queue<ValueType> queue = { frontValue, middleValue, backValue };
int size() const;
Usage:
int n = queue.size();
bool isEmpty() const;
true
if the queue contains no elements.
Usage:
if (queue.isEmpty()) ...
void clear();
Usage:
queue.clear();
void enqueue(ValueType value);
value
to the end of the queue.
Usage:
queue.enqueue(value);
ValueType dequeue();
Usage:
ValueType first = queue.dequeue();
ValueType peek() const;
front
, in which case it returns the
value by reference.
Usage:
ValueType first = queue.peek();
string toString();
Usage:
string str = queue.toString();