istream_iterator is an input iterator that reads successive elements from an input stream
istream_iterator
s require a template parameter this parameter is used to select the appropriate operator>>
from the istream
they are constructed with.
The istream_iterator::operator++
calls operator>>
. Because the extraction is performed when the operator++
is used, the construction of an istream_iterator
extracts a seed value from the istream
so that it can immediately be read with the istream_iterator::operator*
.
The default constructed istream_iterator
is considered the "end-of-stream" iterator. Any istream_iterator
of the same type which has reached the end of the istream
it was constructed with will evaluate equal to the default constructed istream_iterator
.
For more information: http://en.cppreference.com/w/cpp/iterator/istream_iterator