Fixing istreambuf_iterator -------------------------- 26-Jan-95 by Nathan Myers X3J16/95-0022 Rogue Wave Software WG21/0622 I propose a minor addition to istreambuf_iterator to make it conform better to the Forward Iterator specification: inline istreambuf::proxy::operator istreambuf_iterator() { return sbuf_; } Next, as an (almost) editorial matter, section 27.2.3 paragraph 2 should be fixed to accurately describe istreambuf_iterator's behavior. Rather than: After it is constructed, and every time operator++ is used, the iterator reads and stores a value of character. ... It should read: Each time operator++ is used, the iterator advances to the next character of input. operator* provides access to the current input character, if any. The distinction is important if there are no characters to read, or if there is more than one user of the streambuf, or if the streambuf is attached to an unbuffered source of characters. Finally, for performance, the member equal() should true if and only if both iterators are either at end-of-stream, or are the end-of-stream value, regardless of what streambuf they iterate over. This makes a factor-of-two difference in the performance possible when reading characters using the iterators.