📄 list.h
字号:
/* list.h */
#ifndef _LIST_H
#define _LIST_H
typedef enum { FALSE_, TRUE_ } bool2;
//enum { FALSE_, TRUE_ } bool;
/* The following class defines a "list element" -- which is
* used to keep track of one item on a list. It is equivalent to a
* Internal data structures kept public so that List operations can
* access them directly.
*/
class ListElement {
public:
ListElement(void *itemPtr, int sortKey); /* initialize a list element */
ListElement *next; /* next element on list,
NULL if this is the last */
int key; /* priority, for a sorted list */
void *item; /* pointer to item on the list */
};
/* The following class defines a "list" -- a singly linked list of
* list elements, each of which points to a single item on the list.
*
*/
class List1 {
public:
List1(); /* de-allocate the list */
~List1(); /* */
bool IsEmpty(); /* is the list empty? */
void Insert(void *item, int sortKey); /* Put item into list */
void *Remove(int *keyPtr); /* Remove first item from list */
private:
ListElement *first; /* Head of the list, NULL if list is empty */
ListElement *last; /* Last element of list */
};
#endif /* _LIST_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -