ISO/ IEC JTC1/SC22/WG21 N0753

 
** Title: ostreambuf_iterator exception semantics
** Author: Nathan Myers <myersn@roguewave.com>
** Sections: 24.4.4.1 and 24.4.4.3
** Document:  WG21/N0753
             X3J16/95-0153
 
---------------------------------------------------------------
 
** Description
 
The ostreambuf_iterator that decouples iostream from the
locale facet interface provides no mechanism to allow output
errors to be detected.  locale facets need to be able to detect
such errors and report them to their caller (typically ostream).
 
** Discussion
 
Failures of abstraction in C++ are typically handled by throwing an
exception.  Output Iterators are, in general, already allowed to throw
an exception if they cannot perform an operation; it is necessary only
to specify that this is what ostream_iterator does.
 
** Proposed Resolution
 
Amend the Draft as follows:
 
In Section 24.4.4.1 [lib.ostreambuf.iter.cons], for operator=(charT c):
 
  "Effects: Calls sbuf_->sputc(c), and throws runtime_error if it
   returns a value equal to traits::eof()."
 
In Section 24.4.4.2 [lib.ostreambuf.iter.ops], eliminate the
ostreambuf_iterator member equal(ostreambuf_iterator& b).
 
In Section 24.4.4.3 [lib.ostreambuf.iterator.nonmembers],
eliminate global operators == and !=.