-
Notifications
You must be signed in to change notification settings - Fork 0
/
Queue.h
53 lines (40 loc) · 825 Bytes
/
Queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "LinkedList.h"
template<typename T>
class Queue
{
protected:
LinkedList<T> queue;
public:
void enqueue(const T&);
bool dequeue();
const T peekFront() const;
bool isEmpty() const;
int getSize() const;
void Print(UI* ptr, char seperator = ',') const;
};
template<typename T>
void Queue<T>::enqueue(const T& val) {
queue.addBack(val);
}
template<typename T>
bool Queue<T>::dequeue() {
return queue.removeFront();
}
template<typename T>
const T Queue<T>::peekFront() const{
return queue.getIterator()->getValue();
}
template<typename T>
bool Queue<T>::isEmpty() const {
return queue.isEmpty();
}
template<typename T>
int Queue<T>::getSize() const {
return queue.getSize();
}
template<typename T>
void Queue<T>::Print(UI* ptr, char seperator) const
{
queue.Print(ptr, seperator);
}