ISO/ IEC JTC1/SC22/WG21 N0753

** Title: ostreambuf_iterator exception semantics
** Author: Nathan Myers <>
** Sections: and
** Document:  WG21/N0753
** 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 [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 [lib.ostreambuf.iter.ops], eliminate the
ostreambuf_iterator member equal(ostreambuf_iterator& b).
In Section [lib.ostreambuf.iterator.nonmembers],
eliminate global operators == and !=.