Files
cppdraft_translate/cppdraft/std/manip.md
2025-10-25 03:02:53 +03:00

6.3 KiB
Raw Blame History

[std.manip]

31 Input/output library [input.output]

31.7 Formatting and manipulators [iostream.format]

31.7.7 Standard manipulators [std.manip]

1

#

The header defines several functions that support extractors and inserters that alter information maintained by classios_base and its derived classes.

🔗

unspecified resetiosflags(ios_base::fmtflags mask);

2

#

Returns: An object of unspecified type such that if out is an object of typebasic_ostream<charT, traits> then the expressionout << resetiosflags(mask) behaves as if it calledf(out, mask), or if in is an object of typebasic_istream<charT, traits> then the expressionin >> resetiosflags(mask) behaves as if it calledf(in, mask), where the function f is defined as:291void 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 typebasic_istream<charT, traits>& and value in.

🔗

unspecified setiosflags(ios_base::fmtflags mask);

3

#

Returns: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setiosflags(mask) behaves as if it calledf(out, mask), or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setiosflags(mask) behaves as if it calledf(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 expressionout << setiosflags(mask) has typebasic_ostream<charT, traits>& and valueout.

The expressionin >> setiosflags(mask) has typebasic_istream<charT, traits>& and valuein.

🔗

unspecified setbase(int base);

4

#

Returns: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setbase(base) behaves as if it calledf(out, base), or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setbase(base) behaves as if it calledf(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 expressionout << setbase(base) has typebasic_ostream<charT, traits>& and valueout.

The expressionin >> setbase(base) has typebasic_istream<charT, traits>& and valuein.

🔗

unspecified setfill(char_type c);

5

#

Returns: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> and c has typecharT then the expressionout << setfill(c) behaves as if it calledf(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 expressionout << setfill(c) has typebasic_ostream<charT, traits>& and valueout.

🔗

unspecified setprecision(int n);

6

#

Returns: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setprecision(n) behaves as if it calledf(out, n), or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setprecision(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set precision str.precision(n);}

The expressionout << setprecision(n) has typebasic_ostream<charT, traits>& and valueout.

The expressionin >> setprecision(n) has typebasic_istream<charT, traits>& and valuein.

🔗

unspecified setw(int n);

7

#

Returns: An object of unspecified type such that ifout is an instance ofbasic_ostream<charT, traits> then the expressionout << setw(n) behaves as if it calledf(out, n), or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setw(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set width str.width(n);}

The expressionout << setw(n) has typebasic_ostream<charT, traits>& and valueout.

The expressionin >> setw(n) has typebasic_istream<charT, traits>& and valuein.

291)291)

The expression cin >> resetiosflags(ios_base::skipws) clears ios_base::skipws in the format flags stored in thebasic_istream<charT, traits> object cin (the same ascin >> noskipws), and the expressioncout << resetiosflags(ios_base::showbase) clears ios_base::showbase in the format flags stored in the basic_ostream<charT, traits> objectcout (the same as cout << noshowbase).