aboutsummaryrefslogtreecommitdiff
path: root/backend/List.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
commit5c34847218e8d754447f5cf71ed595bbb412eee7 (patch)
tree2872948e6d2f566dd66cb1a9b2a5d9900db4c44f /backend/List.h
parenta04cb74fee079e3ee43ae5fae32fc2674409822c (diff)
more WIP
Diffstat (limited to 'backend/List.h')
-rw-r--r--backend/List.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/backend/List.h b/backend/List.h
new file mode 100644
index 0000000..2d3d6b1
--- /dev/null
+++ b/backend/List.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <stdlib.h>
+
+template <typename T>
+class ListRange;
+
+template <typename T>
+class ListIterator;
+
+template <typename T>
+struct ListLink {
+ ListLink<T> * prev;
+ ListLink<T> * next;
+ T value;
+};
+
+template<typename T>
+class List {
+public:
+ size_t size();
+
+ void push_back(T el);
+
+ void pop_back();
+
+ void clear();
+
+ T & operator [] (size_t index);
+
+ ListIterator<T> begin();
+ ListIterator<T> end();
+ ListRange<T> range();
+
+private:
+ ListLink<T> * head = nullptr;
+ ListLink<T> * tail = nullptr;
+ size_t length = 0;
+};
+
+#include "List.hpp"
+