queue.h

来自「datastucutre and algorithms, application」· C头文件 代码 · 共 30 行

H
30
字号
// abstract class queue
// abstract data type specification for queue data structure
// all methods are pure virtual functions

#ifndef queue_
#define queue_

using namespace std;

template<class T>
class queue 
{
   public:
      virtual ~queue() {}
      virtual bool empty() const = 0;
                  // return true iff queue is empty
      virtual int size() const = 0;
                  // return number of elements in queue
      virtual T& front() = 0;
                  // return reference to the front element
      virtual T& back() = 0;
                  // return reference to the back element
      virtual void pop() = 0;
                  // remove the front element
      virtual void push(const T& theElement) = 0;
                  // add theElement at the back of the queue
};
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?