470 lines
14 KiB
Markdown
470 lines
14 KiB
Markdown
[std.ios.manip]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.5 Iostreams base classes [[iostreams.base]](iostreams.base#std.ios.manip)
|
||
|
||
### 31.5.5 ios_base manipulators [std.ios.manip]
|
||
|
||
#### [31.5.5.1](#fmtflags.manip) fmtflags manipulators [[fmtflags.manip]](fmtflags.manip)
|
||
|
||
[1](#fmtflags.manip-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2401)
|
||
|
||
Each function specified in this subclause
|
||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#fmtflags.manip-1.sentence-1)
|
||
|
||
[ð](#lib:boolalpha)
|
||
|
||
`ios_base& boolalpha(ios_base& str);
|
||
`
|
||
|
||
[2](#fmtflags.manip-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2411)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::boolalpha)[.](#fmtflags.manip-2.sentence-1)
|
||
|
||
[3](#fmtflags.manip-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2416)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-3.sentence-1)
|
||
|
||
[ð](#lib:noboolalpha)
|
||
|
||
`ios_base& noboolalpha(ios_base& str);
|
||
`
|
||
|
||
[4](#fmtflags.manip-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2427)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::boolalpha)[.](#fmtflags.manip-4.sentence-1)
|
||
|
||
[5](#fmtflags.manip-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2432)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-5.sentence-1)
|
||
|
||
[ð](#lib:showbase)
|
||
|
||
`ios_base& showbase(ios_base& str);
|
||
`
|
||
|
||
[6](#fmtflags.manip-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2443)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::showbase)[.](#fmtflags.manip-6.sentence-1)
|
||
|
||
[7](#fmtflags.manip-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2448)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-7.sentence-1)
|
||
|
||
[ð](#lib:noshowbase)
|
||
|
||
`ios_base& noshowbase(ios_base& str);
|
||
`
|
||
|
||
[8](#fmtflags.manip-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2459)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::showbase)[.](#fmtflags.manip-8.sentence-1)
|
||
|
||
[9](#fmtflags.manip-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2464)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-9.sentence-1)
|
||
|
||
[ð](#lib:showpoint)
|
||
|
||
`ios_base& showpoint(ios_base& str);
|
||
`
|
||
|
||
[10](#fmtflags.manip-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2475)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::showpoint)[.](#fmtflags.manip-10.sentence-1)
|
||
|
||
[11](#fmtflags.manip-11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2480)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-11.sentence-1)
|
||
|
||
[ð](#lib:noshowpoint)
|
||
|
||
`ios_base& noshowpoint(ios_base& str);
|
||
`
|
||
|
||
[12](#fmtflags.manip-12)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2491)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::showpoint)[.](#fmtflags.manip-12.sentence-1)
|
||
|
||
[13](#fmtflags.manip-13)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2496)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-13.sentence-1)
|
||
|
||
[ð](#lib:showpos)
|
||
|
||
`ios_base& showpos(ios_base& str);
|
||
`
|
||
|
||
[14](#fmtflags.manip-14)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2507)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::showpos)[.](#fmtflags.manip-14.sentence-1)
|
||
|
||
[15](#fmtflags.manip-15)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2512)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-15.sentence-1)
|
||
|
||
[ð](#lib:noshowpos)
|
||
|
||
`ios_base& noshowpos(ios_base& str);
|
||
`
|
||
|
||
[16](#fmtflags.manip-16)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2523)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::showpos)[.](#fmtflags.manip-16.sentence-1)
|
||
|
||
[17](#fmtflags.manip-17)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2528)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-17.sentence-1)
|
||
|
||
[ð](#lib:skipws)
|
||
|
||
`ios_base& skipws(ios_base& str);
|
||
`
|
||
|
||
[18](#fmtflags.manip-18)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2539)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::skipws)[.](#fmtflags.manip-18.sentence-1)
|
||
|
||
[19](#fmtflags.manip-19)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2544)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-19.sentence-1)
|
||
|
||
[ð](#lib:noskipws)
|
||
|
||
`ios_base& noskipws(ios_base& str);
|
||
`
|
||
|
||
[20](#fmtflags.manip-20)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2555)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::skipws)[.](#fmtflags.manip-20.sentence-1)
|
||
|
||
[21](#fmtflags.manip-21)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2560)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-21.sentence-1)
|
||
|
||
[ð](#lib:uppercase)
|
||
|
||
`ios_base& uppercase(ios_base& str);
|
||
`
|
||
|
||
[22](#fmtflags.manip-22)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2571)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::uppercase)[.](#fmtflags.manip-22.sentence-1)
|
||
|
||
[23](#fmtflags.manip-23)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2576)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-23.sentence-1)
|
||
|
||
[ð](#lib:nouppercase)
|
||
|
||
`ios_base& nouppercase(ios_base& str);
|
||
`
|
||
|
||
[24](#fmtflags.manip-24)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2587)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::uppercase)[.](#fmtflags.manip-24.sentence-1)
|
||
|
||
[25](#fmtflags.manip-25)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2592)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-25.sentence-1)
|
||
|
||
[ð](#lib:unitbuf)
|
||
|
||
`ios_base& unitbuf(ios_base& str);
|
||
`
|
||
|
||
[26](#fmtflags.manip-26)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2603)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::unitbuf)[.](#fmtflags.manip-26.sentence-1)
|
||
|
||
[27](#fmtflags.manip-27)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2608)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-27.sentence-1)
|
||
|
||
[ð](#lib:nounitbuf)
|
||
|
||
`ios_base& nounitbuf(ios_base& str);
|
||
`
|
||
|
||
[28](#fmtflags.manip-28)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2619)
|
||
|
||
*Effects*: Callsstr.unsetf(ios_base::unitbuf)[.](#fmtflags.manip-28.sentence-1)
|
||
|
||
[29](#fmtflags.manip-29)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2624)
|
||
|
||
*Returns*: str[.](#fmtflags.manip-29.sentence-1)
|
||
|
||
#### [31.5.5.2](#adjustfield.manip) adjustfield manipulators [[adjustfield.manip]](adjustfield.manip)
|
||
|
||
[1](#adjustfield.manip-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2631)
|
||
|
||
Each function specified in this subclause
|
||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#adjustfield.manip-1.sentence-1)
|
||
|
||
[ð](#lib:internal)
|
||
|
||
`ios_base& internal(ios_base& str);
|
||
`
|
||
|
||
[2](#adjustfield.manip-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2641)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::internal, ios_base::adjustfield)[.](#adjustfield.manip-2.sentence-1)
|
||
|
||
[3](#adjustfield.manip-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2646)
|
||
|
||
*Returns*: str[.](#adjustfield.manip-3.sentence-1)
|
||
|
||
[ð](#lib:left)
|
||
|
||
`ios_base& left(ios_base& str);
|
||
`
|
||
|
||
[4](#adjustfield.manip-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2657)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::left, ios_base::adjustfield)[.](#adjustfield.manip-4.sentence-1)
|
||
|
||
[5](#adjustfield.manip-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2662)
|
||
|
||
*Returns*: str[.](#adjustfield.manip-5.sentence-1)
|
||
|
||
[ð](#lib:right)
|
||
|
||
`ios_base& right(ios_base& str);
|
||
`
|
||
|
||
[6](#adjustfield.manip-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2673)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::right, ios_base::adjustfield)[.](#adjustfield.manip-6.sentence-1)
|
||
|
||
[7](#adjustfield.manip-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2678)
|
||
|
||
*Returns*: str[.](#adjustfield.manip-7.sentence-1)
|
||
|
||
#### [31.5.5.3](#basefield.manip) basefield manipulators [[basefield.manip]](basefield.manip)
|
||
|
||
[1](#basefield.manip-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2685)
|
||
|
||
Each function specified in this subclause
|
||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#basefield.manip-1.sentence-1)
|
||
|
||
[ð](#lib:dec)
|
||
|
||
`ios_base& dec(ios_base& str);
|
||
`
|
||
|
||
[2](#basefield.manip-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2695)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::dec, ios_base::basefield)[.](#basefield.manip-2.sentence-1)
|
||
|
||
[3](#basefield.manip-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2700)
|
||
|
||
*Returns*: str[.](#basefield.manip-3.sentence-1)[265](#footnote-265 "The function signature dec(ios_base&) can be called by the function signature basic_ostream& stream::operator<<(ios_base& (*)(ios_base&)) to permit expressions of the form cout << dec to change the format flags stored in cout.")
|
||
|
||
[ð](#lib:hex)
|
||
|
||
`ios_base& hex(ios_base& str);
|
||
`
|
||
|
||
[4](#basefield.manip-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2722)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::hex, ios_base::basefield)[.](#basefield.manip-4.sentence-1)
|
||
|
||
[5](#basefield.manip-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2727)
|
||
|
||
*Returns*: str[.](#basefield.manip-5.sentence-1)
|
||
|
||
[ð](#lib:oct)
|
||
|
||
`ios_base& oct(ios_base& str);
|
||
`
|
||
|
||
[6](#basefield.manip-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2738)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::oct, ios_base::basefield)[.](#basefield.manip-6.sentence-1)
|
||
|
||
[7](#basefield.manip-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2743)
|
||
|
||
*Returns*: str[.](#basefield.manip-7.sentence-1)
|
||
|
||
[265)](#footnote-265)[265)](#footnoteref-265)
|
||
|
||
The function signaturedec(ios_base&) can be called by
|
||
the function signaturebasic_ostream& stream::operator<<(ios_base& (*)(ios_base&)) to permit expressions of the formcout << dec to change the format flags stored incout[.](#footnote-265.sentence-1)
|
||
|
||
#### [31.5.5.4](#floatfield.manip) floatfield manipulators [[floatfield.manip]](floatfield.manip)
|
||
|
||
[1](#floatfield.manip-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2750)
|
||
|
||
Each function specified in this subclause
|
||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#floatfield.manip-1.sentence-1)
|
||
|
||
[ð](#lib:fixed)
|
||
|
||
`ios_base& fixed(ios_base& str);
|
||
`
|
||
|
||
[2](#floatfield.manip-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2760)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::fixed, ios_base::floatfield)[.](#floatfield.manip-2.sentence-1)
|
||
|
||
[3](#floatfield.manip-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2765)
|
||
|
||
*Returns*: str[.](#floatfield.manip-3.sentence-1)
|
||
|
||
[ð](#lib:scientific)
|
||
|
||
`ios_base& scientific(ios_base& str);
|
||
`
|
||
|
||
[4](#floatfield.manip-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2776)
|
||
|
||
*Effects*: Callsstr.setf(ios_base::scientific, ios_base::floatfield)[.](#floatfield.manip-4.sentence-1)
|
||
|
||
[5](#floatfield.manip-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2781)
|
||
|
||
*Returns*: str[.](#floatfield.manip-5.sentence-1)
|
||
|
||
[ð](#lib:hexfloat)
|
||
|
||
`ios_base& hexfloat(ios_base& str);
|
||
`
|
||
|
||
[6](#floatfield.manip-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2792)
|
||
|
||
*Effects*: Calls str.setf(ios_base::fixed | ios_base::scientific,
|
||
ios_base::floatfield)[.](#floatfield.manip-6.sentence-1)
|
||
|
||
[7](#floatfield.manip-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2797)
|
||
|
||
*Returns*: str[.](#floatfield.manip-7.sentence-1)
|
||
|
||
[8](#floatfield.manip-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2802)
|
||
|
||
[*Note [1](#floatfield.manip-note-1)*:
|
||
|
||
ios_base::hex cannot be used to specify
|
||
a hexadecimal floating-point format,
|
||
because it is not part of ios_base::floatfield (Table [137](ios.fmtflags#tab:ios.fmtflags.const "Table 137: fmtflags constants"))[.](#floatfield.manip-8.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:defaultfloat)
|
||
|
||
`ios_base& defaultfloat(ios_base& str);
|
||
`
|
||
|
||
[9](#floatfield.manip-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2816)
|
||
|
||
*Effects*: Calls str.unsetf(ios_base::floatfield)[.](#floatfield.manip-9.sentence-1)
|
||
|
||
[10](#floatfield.manip-10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2820)
|
||
|
||
*Returns*: str[.](#floatfield.manip-10.sentence-1)
|