Each formatted output function begins execution by constructing an object of class
sentry. If that object returns
true
when converted to a value of type
bool,
the function endeavors
to generate the requested output
. If the generation fails, then the formatted output function does
setstate(ios_base::failbit),
which can throw an exception
. If an exception is thrown during output, then
ios_base::badbit
is set
in
*this's
error state
. If
(exceptions()&badbit) != 0
then the exception is rethrown
. Whether or not an exception is thrown, the
sentry
object is destroyed before leaving the formatted output function
. If no exception is thrown, the result of the formatted output function
is
*this.