InputRange
You’ll learn about the InputRange with the help of an example in this lesson.
We'll cover the following...
Introduction
This type of range models the type of iteration where elements are accessed in sequence, as you have seen in the print()
functions above. Most algorithms only require that elements are iterated in the forward direction without needing to look at elements that have already been iterated over. InputRange also models the standard input streams of programs, where elements are removed from the stream as they are read.
For completeness, here are the three functions that InputRange requires:
-
empty
: specifies whether the range is empty; it must return true when the range is considered to be empty and false otherwise -
front
: ...