21 lines
580 B
C
21 lines
580 B
C
|
#ifndef QUEUE_H
|
||
|
#define QUEUE_H
|
||
|
|
||
|
#include "Object.h"
|
||
|
|
||
|
namespace Kylin {
|
||
|
template <typename T>
|
||
|
class Queue : public Object {
|
||
|
public:
|
||
|
virtual T &head() = 0;
|
||
|
const T &head() const { return const_cast<Queue *>(this)->head(); }
|
||
|
virtual T dequeue() = 0;
|
||
|
virtual void enqueue(const T &t) = 0;
|
||
|
virtual void clear() = 0;
|
||
|
virtual size_t size() const noexcept = 0;
|
||
|
inline virtual size_t length() const noexcept { return size(); }
|
||
|
inline virtual bool empty() const noexcept { return size() == 0; }
|
||
|
};
|
||
|
} // namespace Kylin
|
||
|
#endif // QUEUE_H
|