aboutsummaryrefslogtreecommitdiff
path: root/linked_list.cpp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-19 12:08:03 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-19 12:08:03 +0100
commit86cb382c91fa965ad84d97c8c8e21957e695a1ae (patch)
tree88b5fc4e4eac2554a31485342d2d1c8bc5255075 /linked_list.cpp
parentJag kan inte ens programmera på rätt dator... (diff)
downloadcalp-86cb382c91fa965ad84d97c8c8e21957e695a1ae.tar.gz
calp-86cb382c91fa965ad84d97c8c8e21957e695a1ae.tar.xz
Further changes.
Diffstat (limited to 'linked_list.cpp')
-rw-r--r--linked_list.cpp59
1 files changed, 0 insertions, 59 deletions
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 <typename T>
-llink<T>::~llink () {
- this.unlink();
-}
-
-template <typename T>
-void llink<T>::unlink () {
- if (this->before != nullptr) this->before->after = this->after;
- if (this->after != nullptr) this->after->before = this->before;
-}
-
-template <typename T>
-T& llist<T>::peek() {
- if (this->empty()) return nullptr;
-
- return FIRST(this)->value;
-}
-
-template <typename T>
-T& llist<T>::pop() {
- if (this->empty()) return nullptr;
-
- llink<T>* frst = FIRST(this);
- frst.unlinke();
-
- T& retval = frst->value;
- --this->length;
- delete frst;
-
- return retval;
-}
-
-template <typename T>
-void llist<T>::operator+= (llist<T>& 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 <typename T>
-// std::ostream& std::operator<<(std::ostream&, llist<T>) {
-// o << '(';
-// for (T t : list) {
-// o << t;
-// }
-// o << ')';
-// }