63 lines
2.5 KiB
Markdown
63 lines
2.5 KiB
Markdown
[ostream.formatted.reqmts]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#ostream.formatted.reqmts)
|
||
|
||
### 31.7.6 Output streams [[output.streams]](output.streams#ostream.formatted.reqmts)
|
||
|
||
#### 31.7.6.3 Formatted output functions [[ostream.formatted]](ostream.formatted#reqmts)
|
||
|
||
#### 31.7.6.3.1 Common requirements [ostream.formatted.reqmts]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6354)
|
||
|
||
Each formatted output function begins execution by constructing an object of classsentry[.](#1.sentence-1)
|
||
|
||
If that object returnstrue when converted to a value of typebool,
|
||
the function endeavors
|
||
to generate the requested output[.](#1.sentence-2)
|
||
|
||
If the generation fails, then the formatted output function doessetstate(ios_base::failbit),
|
||
which can throw an exception[.](#1.sentence-3)
|
||
|
||
If an exception is thrown during output, thenios_base::badbit is set[285](#footnote-285 "This is done without causing an ios_base::failure to be thrown.") in*this's
|
||
error state[.](#1.sentence-4)
|
||
|
||
If(exceptions() & badbit) != 0 then the exception is rethrown[.](#1.sentence-5)
|
||
|
||
Whether or not an exception is thrown, thesentry object is destroyed before leaving the formatted output function[.](#1.sentence-6)
|
||
|
||
If no exception is thrown, the result of the formatted output function
|
||
is*this[.](#1.sentence-7)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6387)
|
||
|
||
The descriptions of the individual formatted output functions
|
||
describe how they perform
|
||
output and do not mention thesentry object[.](#2.sentence-1)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6394)
|
||
|
||
If a formatted output function of a stream os determines
|
||
padding, it does so as
|
||
follows[.](#3.sentence-1)
|
||
|
||
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[.](#3.sentence-2)
|
||
|
||
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[.](#3.sentence-3)
|
||
|
||
[285)](#footnote-285)[285)](#footnoteref-285)
|
||
|
||
This is done without causing anios_base::failure to be thrown[.](#footnote-285.sentence-1)
|