single character (1) | template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, charT c);template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, signed char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, unsigned char c); |
---|---|
character sequence (2) | template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, const charT* s);template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, const char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const signed char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const unsigned char* s); |
single character (1) | template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, charT c);template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, signed char c);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<char,traits>& os, unsigned char c); |
---|---|
character sequence (2) | template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, const charT* s);template<class charT, class traits>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>& os, const char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const signed char* s);template<class traits>basic_ostream<char,traits>& operator<< (basic_ostream<charT,traits>& os, const unsigned char* s); |
rvalue insertion (3) | template<class charT, class traits, class T>basic_ostream<charT,traits>& operator<< (basic_ostream<charT,traits>&& os, const T& val); |
<<
) applied to an output stream is known as insertion operator, and performs formatted output:os<<val
.os.width()
characters into os: if the characters to insert are less, they are padded with fill characters inserted before c or s, unless os's adjustfield setting is left (in this case, the fill characters are inserted after c or s).char
, and this type is different from charT (the character type handled by os), the character inserted is os.widen(c)
.char
, and this type is different from charT (the character type handled by os), each character inserted is widened using os.widen
.flag | error |
---|---|
eofbit | - |
failbit | The function failed while formatting the output (it may also be set if the construction of sentry failed). |
badbit | Either the insertion on the stream failed, or some other error happened (such as when this function catches an exception thrown by an internal operation). When set, the integrity of the stream may have been affected. |
|
|
Example string ****X |