cpp/iterator/istream iterator

is a single-pass input iterator that reads successive objects of type from the std object for which it was constructed, by calling the appropriate. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first object is read when the iterator is constructed. Dereferencing only returns a copy of the most recently read object.

The default-constructed is known as the end-of-stream iterator. When a valid reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior. An end-of-stream iterator remains in the end-of-stream state even if the underlying stream changes state. Absent a reassignment, it cannot become a non-end-of-stream iterator anymore.

A typical implementation of holds two data members: a pointer to the associated std object and the most recently read value of type.

must meet the, , and requirements.