⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stack.h

📁 数据结构与算法分析(C++)(版第二版)源码
💻 H
字号:
// Stack abtract class
template <class Elem> class Stack {
public:
  // Reinitialize the stack.  The user is responsible for
  // reclaiming the storage used by the stack elements.
  virtual void clear() = 0;
  // Push an element onto the top of the stack.  Return
  // true if successful, false if not (if stack is full).
  virtual bool push(const Elem&) = 0;
  // Remove the element at the top of the stack. Return
  // true if succesful, false if stack is empty.
  // The element removed is returned in the first parameter.
  virtual bool pop(Elem&) = 0; // Pop Elem from top of stack
  // Return in first parameter a copy of the top element.
  // Return true if succesful, false if stack is empty.
  virtual bool topValue(Elem&) const = 0;
  // Return the number of elements in the stack.
  virtual int length() const = 0;
};

⌨️ 快捷键说明

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