genqueue.h
来自「这是清华出的这本经典的数据结构第三版上的随书例子。希望对大家有用。」· C头文件 代码 · 共 37 行
H
37 行
//********************** genQueue.h *************************// generic queue implemented with doubly linked list #ifndef DLL_QUEUE#define DLL_QUEUE#include <list>template<class T>class Queue {public: Queue() { } void clear() { lst.clear(); } bool isEmpty() const { return lst.empty(); } T& front() { return lst.front(); } T dequeue() { T el = lst.front(); lst.pop_front(); return el; } void enqueue(const T& el) { lst.push_back(el); }private: list<T> lst;};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?