blob: 3bdbb238442c6595fbf264a6ee58fba584e2bf06 (
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
48
49
|
#pragma once
#include <stdlib.h>
template <typename T>
class ListRange;
template <typename T>
class ListIterator;
template <typename T>
struct ListLink {
friend class ListIterator<T>;
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(const T & el);
void remove(const T & val);
void pop_back();
void clear();
T & operator [] (size_t index) const;
ListIterator<T> begin();
ListIterator<T> end();
ListRange<T> range();
private:
friend class ListRange<T>;
ListLink<T> * head = nullptr;
ListLink<T> * tail = nullptr;
size_t length = 0;
};
#include "List.hpp"
|