input/output manipulator
Operators are helper functions that enable code to control input/output streams using operator<< or operator>>.
Manipulators called without arguments (such as std::cout << std::boolalpha; or std::cin >> std::hex; ) are implemented as functions that accept a reference to a stream as their only argument. Special overloaded versions of basic_ostream::operator<< and basic_istream::operator>> accept pointers to these functions. These functions (or instantiations of function templates) are the only addressable functions in the standard library. (since C++20)
Manipulators called with arguments (such as std::cout << std::setw(10); ) are implemented as functions that return an object of unspecified type. These operators define their own operator<<
OR that performs the requested operation operator>>
.
defined in header file |
alphanumeric noboolalpha |
Switch between textual and numeric representation of a Boolean value (function) |
showbase and showbase |
Controls whether a prefix is used to indicate numeric base (function) |
showpointnoshowpoint |
Controls whether floating point representations always include a decimal point (function) |
showpos noshowpos |
Controls whether + the sign is used with non-negative numbers (function) |
skipws noskipws |
Controls whether leading whitespace characters on input are skipped (function) |
uppercase nouppercase |
Controls whether some output operations use uppercase letters (function) |
unitbuf nounitbuf |
Controls whether the output is flushed after each operation (function) |
internal left right |
Sets the placement of fill characters (function) |
dec hex oct |
Change the base used for integer I/O (function) |
fixed scientific hexfloat defaultfloat (C++11)(C++11) |
Change the format used for floating-point I/O (function) |
defined in header file |
ws |
Consume whitespace (function template) |
defined in header file |
ends |
Output '\0' (function template) |
flush |
Flush the output stream (function template) |
endl |
Output '\n' and flush the output stream (function template) |
emit_on_flush no_emit_on_flush (C++20) |
Whether the basic_syncbuf of the control flow is emitted when rushing in (function template) |
flush_emit (C++20) |
Rush into the stream and emit its contents if it uses basic_syncbuf (function template) |
defined in header file |
resetiosflags |
Clears the specified ios_base flag (function) |
setiosflags |
Sets the specified ios_base flag (function) |
setbase |
Change the base used for integer I/O (function) |
setfill |
Change fill characters (function template) |
setprecision |
Change floating point precision (function) |
setw |
Change the width of the next input/output field (function) |
get_money (C++11) |
剖析货币值 (函数模板) |
put_money (C++11) |
格式化并输出货币值 (函数模板) |
get_time (C++11) |
剖析指定格式的日期/时间值 (函数模板) |
put_time (C++11) |
按照指定格式格式化并输出日期/时间值 (函数模板) |
quoted (C++14) |
插入和读取带有内嵌空格的被引号括起来的字符串 (函数模板) |