It is often better to use the stream buffer directly instead of using istream member functions.
Stream buffers provide member functions that read single characters or character sequences efficiently,
without overhead due to the construction of sentry objects (see Section 15.5.4, page 772,
for more information on sentry objects). Section 15.13, page 826, explains the stream buffer interface
in detail. Another alternative is to use the class template istreambuf_iterator, which
provides an iterator interface to the stream buffer (see Section 15.13.2, page 828).