aboutsummaryrefslogtreecommitdiff
path: root/backend/List.h
blob: 2d3d6b142b4987fbba84d905c103def7aff2f820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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"