blob: 5e4ea9156cab59ad2061012d8af53a735363e28d (
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
|
#pragma once
#include "ListIterator.h"
template <typename T>
ListRange<T>::ListRange(List<T> & list) : list(list) { }
template <typename T>
ListIterator<T> ListRange<T>::begin() const {
return { this->list, 0 };
}
template <typename T>
ListIterator<T> ListRange<T>::end() const {
return { this->list, this->list.size() };
}
template <typename T>
size_t ListRange<T>::size() const {
return this->list.size();
}
template <typename T>
ListIterator<T>::ListIterator(List<T> & list, size_t index) : list(list), index(index) { }
template <typename T>
T ListIterator<T>::operator * () const {
return this->list[this->index];
}
template <typename T>
ListIterator<T> & ListIterator<T>::operator ++ () {
this->index++;
return *this;
}
template <typename T>
bool ListIterator<T>::operator != (const ListIterator<T> & rhs) const {
return this->index < rhs.index;
}
|