#include <linklist.h>
Public Member Functions |
|
LinkedListT () | |
~LinkedListT () | |
void | New () |
int | Count () |
void | Append (T &item) |
T & | operator[] (int index) |
LinkedListT & | operator= (LinkedListT &from) |
LinkedListT | ( | ) | [inline] |
{ head = tail = NULL; count = 0; }
~LinkedListT | ( | ) | [inline] |
{ New(); }
void New | ( | ) | [inline] |
{ while(head) { TE* next = (TE*)head->next; delete head; head = next; } head = tail = NULL; count = 0; }
int Count | ( | ) | [inline] |
void Append | ( | T & | item | ) | [inline] |
{ TE* entry = new TE(item); if(tail) tail->next = entry; tail = entry; if(!head) head = entry; count++; }
T& operator[] | ( | int | index | ) | [inline] |
{ TE* e = head; while(index && e) { e = (TE*)e->next; index--; } // This should never happen, so we'll punt and return... // the head's data if(!e) { DbgAssert(0); return head->data; } return e->data; }
LinkedListT& operator= | ( | LinkedListT< T, TE > & | from | ) | [inline] |