An istream_iterator is an Input Iterator that performs formatted
input of objects of type T from a particular istream. When end of
stream is reached, the istream_iterator takes on a special end of
stream value, which is a past-the-end iterator. Note that all of the
restrictions of an Input Iterator must be obeyed, including the
restrictions on the ordering of operator* and operator++
operations.
Example
Fill a vector with values read from standard input.
These members are not defined
in the Input Iterator requirements,
but are specific to istream_iterator.
Function
Description
istream_iterator()
The default constructor: Constructs an end-of-stream iterator.
This is a past-the-end iterator, and it is useful when constructing
a "range".
istream_iterator(istream& s)
Creates an istream_iterator that reads values from the input
stream s. When s reaches end of stream, this iterator will
compare equal to an end-of-stream iterator created using the
default constructor.