//---------------------------------------------------------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------------------------------------------------------- template ThinList::ThinList() :next(0) { } //---------------------------------------------------------------------------------------------------------------------- template ThinList::ThinList(const T& aobject, ThinList* anext) :next(anext), object(aobject) { } //---------------------------------------------------------------------------------------------------------------------- template ThinList::ThinList(const ThinList& source) :next(0), object(source.object) { if (source.next != 0) { next = new ThinList(*source.next); } } //---------------------------------------------------------------------------------------------------------------------- template ThinList::~ThinList() { ThinList* deleteEntry = next; while (deleteEntry != 0) { ThinList* nextDeleteEntry = deleteEntry->next; deleteEntry->next = 0; delete deleteEntry; deleteEntry = nextDeleteEntry; } } //---------------------------------------------------------------------------------------------------------------------- // Insert functions //---------------------------------------------------------------------------------------------------------------------- template void ThinList::PushToBack(const T& entry) { ThinList* targetEntry = this; while (targetEntry->next != 0) { targetEntry = targetEntry->next; } targetEntry->next = new ThinList(entry); } //---------------------------------------------------------------------------------------------------------------------- template void ThinList::InsertAfter(const T& entry) { ThinList* newEntry = new ThinList(entry, next); next = newEntry; }