list.h
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C头文件 代码 · 共 39 行
H
39 行
typedef int Index;
const int max_list = 7; // small value for testing purposes
template <class List_entry>
class Node {
public:
List_entry entry;
Index next;
};
template <class List_entry>
class List {
public:
// Methods of the list ADT
List();
int size() const;
bool full() const;
bool empty() const;
void clear();
void traverse(void (*visit)(List_entry &));
Error_code retrieve(int position, List_entry &x) const;
Error_code replace(int position, const List_entry &x);
Error_code remove(int position, List_entry &x);
Error_code insert(int position, const List_entry &x);
protected:
// Data members
Node<List_entry> workspace[max_list];
Index available, last_used, head;
int count;
// Auxiliary member functions
Index new_node();
void delete_node(Index n);
int current_position(Index n) const;
Index set_position(int position) const;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?