diff options
Diffstat (limited to 'backend/List.h')
-rw-r--r-- | backend/List.h | 42 |
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" + |