29 Input/output library [input.output]

29.7 Formatting and manipulators [iostream.format]

29.7.6 Standard manipulators [std.manip]

The header <iomanip> defines several functions that support extractors and inserters that alter information maintained by class ios_­base and its derived classes.
unspecified resetiosflags(ios_base::fmtflags mask);
Returns: An object of unspecified type such that if out is an object of type basic_­ostream<charT, traits> then the expression out << resetiosflags(mask) behaves as if it called f(out, mask), or if in is an object of type basic_­istream<charT, traits> then the expression in >> resetiosflags(​mask) behaves as if it called f(in, mask), where the function f is defined as:325 void f(ios_base& str, ios_base::fmtflags mask) { // reset specified flags str.setf(ios_base::fmtflags(0), mask); }
The expression out << resetiosflags(mask) has type basic_­ostream<charT, traits>& and value out.
The expression in >> resetiosflags(mask) has type basic_­istream<charT, traits>& and value in.
unspecified setiosflags(ios_base::fmtflags mask);
Returns: An object of unspecified type such that if out is an object of type basic_­ostream<charT, traits> then the expression out << setiosflags(mask) behaves as if it called f(out, mask), or if in is an object of type basic_­istream<charT, traits> then the expression in >> setiosflags(mask) behaves as if it called f(in, mask), where the function f is defined as: void f(ios_base& str, ios_base::fmtflags mask) { // set specified flags str.setf(mask); }
The expression out << setiosflags(mask) has type basic_­ostream<charT, traits>& and value out.
The expression in >> setiosflags(mask) has type basic_­istream<charT, traits>& and value in.
unspecified setbase(int base);
Returns: An object of unspecified type such that if out is an object of type basic_­ostream<charT, traits> then the expression out << setbase(base) behaves as if it called f(out, base), or if in is an object of type basic_­istream<charT, traits> then the expression in >> setbase(base) behaves as if it called f(in, base), where the function f is defined as: void f(ios_base& str, int base) { // set basefield str.setf(base == 8 ? ios_base::oct : base == 10 ? ios_base::dec : base == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield); }
The expression out << setbase(base) has type basic_­ostream<charT, traits>& and value out.
The expression in >> setbase(base) has type basic_­istream<charT, traits>& and value in.
unspecified setfill(char_type c);
Returns: An object of unspecified type such that if out is an object of type basic_­ostream<charT, traits> and c has type charT then the expression out << setfill(c) behaves as if it called f(out, c), where the function f is defined as: template<class charT, class traits> void f(basic_ios<charT, traits>& str, charT c) { // set fill character str.fill(c); }
The expression out << setfill(c) has type basic_­ostream<charT, traits>& and value out.
unspecified setprecision(int n);
Returns: An object of unspecified type such that if out is an object of type basic_­ostream<charT, traits> then the expression out << setprecision(n) behaves as if it called f(out, n), or if in is an object of type basic_­istream<charT, traits> then the expression in >> setprecision(n) behaves as if it called f(in, n), where the function f is defined as: void f(ios_base& str, int n) { // set precision str.precision(n); }
The expression out << setprecision(n) has type basic_­ostream<charT, traits>& and value out.
The expression in >> setprecision(n) has type basic_­istream<charT, traits>& and value in.
unspecified setw(int n);
Returns: An object of unspecified type such that if out is an instance of basic_­ostream<charT, traits> then the expression out << setw(n) behaves as if it called f(out, n), or if in is an object of type basic_­istream<charT, traits> then the expression in >> setw(n) behaves as if it called f(in, n), where the function f is defined as: void f(ios_base& str, int n) { // set width str.width(n); }
The expression out << setw(n) has type basic_­ostream<charT, traits>& and value out.
The expression in >> setw(n) has type basic_­istream<charT, traits>& and value in.
The expression cin >> resetiosflags(ios_­base​::​skipws) clears ios_­base​::​skipws in the format flags stored in the basic_­istream<charT, traits> object cin (the same as cin >> noskipws), and the expression cout << resetiosflags(ios_­base​::​showbase) clears ios_­base​::​showbase in the format flags stored in the basic_­ostream<charT, traits> object cout (the same as cout << noshowbase).
 â®¥