ISO/ IEC JTC1/SC22/WG21 N0754

 
** Title: [io]streambuf_iterator cleanup
** Author: Nathan Myers <myersn@roguewave.com>
** Document: WG21/N0754
            X3J16/95-0154
** Sections: 24.4.3, 24.4.4, and 24.4.3.[234]
 
---------------------------------------------------------------
 
** Description
 
1. The typedefs declared in the streambuf iterators can lead to
   confusion because the have the same names as global typedefs.
   While this does not confuse compilers, it confuses readers,
   and is easily fixed.
2. The constructors cannot fail and do not need to throw exceptions,
   so they should be specified as such.  Also, there is no need for
   a default constructor for ostreambuf_iterator.
3. The overloaded global function iterator_category() must be specified
   as a template.
4. The description of semantics of istreambuf_iterator member operators
   is too vague: "Advances the iterator" and "Extract one character"
   are subject to interpretation.
 
** Proposed Resolution
 
Amend the WP as follows:
 
In both 24.4.3 and 24.4.4, change the typedefs "streambuf", "istream",
and "ostream" to "streambuf_type", "istream_type", and "ostream_type",
respectively. In 24.4.3, replace the second and third constructors with:
 
  istreambuf_iterator(istream_type& s) throw();
  istreambuf_iterator(streambuf_type* s) throw();
 
In 24.4.4, replace the first three constructors with:
 
  ostreambuf_iterator(ostream_type& s) throw();
  ostreambuf_iterator(streambuf_type* s) throw();
 
and in both 24.4.3 and 24.4.4, change the declaration of the private
member sbuf_ to:
 
  streambuf_type* sbuf_;  // exposition only
 
In 24.4.3.3:
 
-- Change operator*() description to: "Returns: sbuf_->sgetc()".
 
-- Change operator++() description to:
     "Effects: sbuf_->snextc(); Returns: *this."
 
-- Change operator++(int) description to:
     "Returns: proxy(sbuf_->sbumpc(),sbuf_)."