ranges
rurban opened this issue · 0 comments
More iterator redesigns
STL iterators only contain the pointer and the overload operators to access the node/element and the valueref. That's why you can check in the STL with pos == end(), but we cannot, we must call done()
.
Our iterator is a fat iterator, i.e. it contains the end of the range by itself, i.e. it is secure.
So we can replace all I* first, I* last
pairs in our range variants with a single I*range
arg. The default last is always end, but you can change the end field with our range
method.
Remove the ref field and use the I, ref method in foreach loops. we don't need to set ref in every iteration. Our ref is inlined to the accessor anyway (T* value or node->value).
See also https://www.informit.com/articles/article.aspx?p=1407357
So we can also eventually remove all _range
methods, and replace e.g. A_union (&a, &b)
with a A_union(A_begin(&a), A_begin(&b))
call.