From 86cb382c91fa965ad84d97c8c8e21957e695a1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 19 Feb 2019 12:08:03 +0100 Subject: Further changes. --- linked_list.cpp | 59 --------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 linked_list.cpp (limited to 'linked_list.cpp') diff --git a/linked_list.cpp b/linked_list.cpp deleted file mode 100644 index ed37eb23..00000000 --- a/linked_list.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "linked_list.h" - -template -llink::~llink () { - this.unlink(); -} - -template -void llink::unlink () { - if (this->before != nullptr) this->before->after = this->after; - if (this->after != nullptr) this->after->before = this->before; -} - -template -T& llist::peek() { - if (this->empty()) return nullptr; - - return FIRST(this)->value; -} - -template -T& llist::pop() { - if (this->empty()) return nullptr; - - llink* frst = FIRST(this); - frst.unlinke(); - - T& retval = frst->value; - --this->length; - delete frst; - - return retval; -} - -template -void llist::operator+= (llist& other) { - - /* Link end of dest onto start of new__. */ - LAST(this)->after = FIRST(other); - FIRST(other)->before = LAST(this); - - /* Free the two now not needed end links. */ - delete other->head; - delete other->tail; - - /* Update dest with new__ tail ptr. */ - this->tail = other->tail; - - this->length += other->length; -} - -// template -// std::ostream& std::operator<<(std::ostream&, llist) { -// o << '('; -// for (T t : list) { -// o << t; -// } -// o << ')'; -// } -- cgit v1.2.3