c06p303.txt

来自「Data Abstraction & Problem Solving with 」· 文本 代码 · 共 40 行

TXT
40
字号
template <class T, class Container = deque <T> >class stack{public:   explicit stack(const Container& cnt = Container());   // Default constructor; initializes an empty stack.   // Precondition: None.   // Postcondition: An empty stack exists.   bool empty() const;   // Determines whether the stack is empty.   // Precondition: None.   // Postcondition: Returns true if the stack is empty,   // otherwise returns false.   size_type size() const;   // Determines the size of the stack. The return type   // size_type is an integral type.   // Precondition: None.   // Postcondition: Returns the number of items that   // are currently on the stack.   T &top();   // Returns a reference to the top of the stack.   // Precondition: None.   // Postcondition: The item remains on the stack.   void pop();   // Removes the top item in the stack.   // Precondition: None.   // Postcondition: The item most recently added is removed   // from the stack.   void push(const T& x);   // Adds an item to the top of the stack.   // Precondition: None.   // Postcondition: Item x is on top of the stack.} // end STL stack

⌨️ 快捷键说明

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