blob: 45f9acc7c85945bbc4ba2e1dfdba7f163db8ef85 (
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
50
51
52
|
#pragma once
#include "ListIterator.h"
template <typename T>
ListRange<T>::ListRange(List<T> & list) : list(list) { }
template <typename T>
ListIterator<T> ListRange<T>::begin() {
return { this->list.tail };
}
template <typename T>
ListIterator<T> ListRange<T>::end() {
return { this->list.head };
}
template <typename T>
size_t ListRange<T>::size() const {
return this->list.size();
}
template <typename T>
ListIterator<T>::ListIterator(ListLink<T> * & here) {
this->here = here;
if (this->here != nullptr)
this->next = this->here->next;
}
template <typename T>
T & ListIterator<T>::operator * () const {
return this->here->value;
}
template <typename T>
ListIterator<T> & ListIterator<T>::operator ++ () {
this->here = this->next;
if (this->here != nullptr)
this->next = this->here->next;
return *this;
}
template <typename T>
bool ListIterator<T>::operator != (const ListIterator<T> & rhs) const {
return this->here != nullptr;
}
template <typename T>
bool ListIterator<T>::operator ! () const {
return this->here == nullptr;
}
|