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

📄 genstack.h

📁 这是清华出的这本经典的数据结构第三版上的随书例子。希望对大家有用。
💻 H
字号:
//*********************  genStack.h  *************************//      generic class for vector implementation of stack#ifndef STACK#define STACK#include <vector>template<class T, int capacity = 30>class Stack {public:    Stack() {        pool.reserve(capacity);    }    void clear() {         pool.clear();    }    bool isEmpty() const {         return pool.empty();    }    T& topEl() {         return pool.back();    }    T pop() {         T el = pool.back();        pool.pop_back();        return el;    }    void push(const T& el) {         pool.push_back(el);    }private:    vector<T> pool;};#endif

⌨️ 快捷键说明

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