You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
569 B
35 lines
569 B
#ifndef KList_h
|
|
#define KList_h
|
|
|
|
typedef void* POS;
|
|
template <class T>
|
|
class KList{
|
|
public:
|
|
KList();
|
|
~KList();
|
|
void empty();
|
|
bool addTail(const T& t);
|
|
bool addHead(const T& t);
|
|
T& getTail() const;
|
|
T& getHead() const;
|
|
POS getHeadPosition() const;
|
|
T& getAt(POS& P);
|
|
T& getNext(POS& P);
|
|
void removeHead();
|
|
void removeTail();
|
|
void removeAt(POS& P);
|
|
int getCount() const {return count;};
|
|
protected:
|
|
struct Node{
|
|
T Obj;
|
|
Node* last;
|
|
Node* next;
|
|
};
|
|
Node* head;
|
|
Node* tail;
|
|
int count;
|
|
|
|
};
|
|
#include "KList.cpp"
|
|
|
|
#endif
|