ClosedRangeIterator

ClosedRangeIterator: ClosedRangeIterator, hasValue, value, increment, print, toList, sum

struct ClosedRangeIterator<T>: Iterator<T>, Printable

Iterates over the values of a closed range.

ClosedRangeIterator

ClosedRangeIterator(ClosedRange<T> range)

Initializes an iterator over the given range.

hasValue

bool hasValue()

Returns true if there are more values.

value

T value()

Returns the current value.

increment

void increment()

Advances to the next value.

print

void print(OutputStream& stream)

Prints the remaining values in list form, e.g. [1, 2, 3].

toList

List<T> toList()

Collects the remaining values into a list.

sum

T sum()

Returns the sum of the remaining elements, or zero if there are none.