[ostream.formatted.reqmts] (original) (raw)
31 Input/output library [input.output]
31.7 Formatting and manipulators [iostream.format]
31.7.6 Output streams [output.streams]
31.7.6.3 Formatted output functions [ostream.formatted]
31.7.6.3.1 Common requirements [ostream.formatted.reqmts]
Each formatted output function begins execution by constructing an object of classsentry.
If that object returnstruewhen converted to a value of typebool, the function endeavors to generate the requested output.
If the generation fails, then the formatted output function doessetstate(ios_base::failbit), which can throw an exception.
If an exception is thrown during output, thenios_base::badbitis set286in*this's error state.
If(exceptions() & badbit) != 0then the exception is rethrown.
Whether or not an exception is thrown, thesentryobject is destroyed before leaving the formatted output function.
If no exception is thrown, the result of the formatted output function is*this.
The descriptions of the individual formatted output functions describe how they perform output and do not mention thesentryobject.
If a formatted output function of a stream os determines padding, it does so as follows.
Given a charT character sequence seq wherecharT is the character container type of the stream, if the length of seq is less than os.width(), then enough copies ofos.fill() are added to this sequence as necessary to pad to a width of os.width() characters.
If(os.flags() & ios_base::adjustfield) == ios_base::left istrue, the fill characters are placed after the character sequence; otherwise, they are placed before the character sequence.