IOstreams use streambufs to as their source / target of input / output. Effectively, the streambuf-family does all the work regarding IO and the IOstream-family is only used for formatting and to-string / from-string transformation.

Now, istream_iterator takes a template argument that says what the unformatted string-sequence from the streambuf should be formatted as, like istream_iterator<int> will interpret (whitespace-delimited) all incoming text as ints.

On the other hand, istreambuf_iterator only cares about the raw characters and iterates directly over the associated streambuf of the istream that it gets passed.

Generally, if you're only interested in the raw characters, use an istreambuf_iterator. If you're interested in the formatted input, use an istream_iterator.

All of what I said also applies to ostream_iterator and ostreambuf_iterator.

from https://stackoverflow.com/questions/10564013/c-streams-confusion-istreambuf-iterator-vs-istream-iterator

也就是说,istream_iterator在从streambufs获取输入时,进行了类似'1'->1的转换,而istreambuf_iterator没有,因此,在进行简单的char流IO时,更应该使用istreambuf_iterator/ostreambuf_iterator