The return value of get() is the stream; thus, while tests whether cin is still in a good state.10
For a better performance, you can operate directly on stream buffers. See Section 15.13.2,
page 831, for a version of this example that uses stream buffer iterators for I/O and Section 15.14.3,
page 846, for a version that copies the whole input in one statement.