blob: 1af0b3565c9d8aed2e620a56ad2c6a1816c9f057 (
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
43
44
45
46
47
|
#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:
List() = default;
virtual ~List();
public:
size_t size() const;
void push_back(T & el);
void remove(const T & val);
void pop_back();
void clear();
T & operator [] (size_t index) const;
ListIterator<T> begin() const;
ListIterator<T> end() const;
ListRange<T> range() const;
private:
ListLink<T> * head = nullptr;
ListLink<T> * tail = nullptr;
size_t length = 0;
};
#include "List.hpp"
|