queue.h

来自「数据结构与算法分析」· C头文件 代码 · 共 20 行

H
20
字号
// Abstract queue class
template <class Elem> class Queue {
public:
  // Reinitialize the queue.  The user is responsible for
  // reclaiming the storage used by the stack elements.
  virtual void clear() = 0;
  // Place an element at the rear of the queue.  Return
  // true if successful, false if not (if queue is full).
  virtual bool enqueue(const Elem&) = 0;
  // Remove the element at the front of the queue. Return
  // true if succesful, false if queue is empty.
  // The element removed is returned in the first parameter.
  virtual bool dequeue(Elem&) = 0; // Remove Elem from front
  // Return in first parameter a copy of the front element.
  // Return true if succesful, false if queue is empty.
  virtual bool frontValue(Elem&) const = 0;
  // Return the number of elements in the queue.
  virtual int length() const = 0;
};

⌨️ 快捷键说明

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