UnformattedOutputFunction
Requirements
A UnformattedOutputFunction is a stream output function that performs the following:
- Constructs an object of type
basic_ostream::sentrywith automatic storage duration, which performs the following- if
eofbitorbadbitare set on the output stream, sets thefailbitas well, and if exceptions on failbit are enabled in this output stream's exception mask, throwsios_base::failure. - flushes the tie()'d output stream, if applicable.
- if
- Checks the status of the sentry by calling
sentry::operator bool(), which is equivalent tobasic_ios::good. - If the sentry returned
falseor sentry's constructor threw an exception, no output takes place - If the sentry returned
true, attempts to perform the desired output by inserting the characters into the output stream as if by callingrdbuf()->sputc()orrdbuf()->xsputn(). Additionally,rdbuf()->overflow()andrdbuf()->sync()may be called, but no other virtual member function ofstd::basic_streambuf.- if an exception is thrown during output, sets
badbitin the output stream. If exceptions on badbit are enabled in this stream's exception mask, the exception is also rethrown. - If no exception was thrown, returns the value specified by the function.
- if an exception is thrown during output, sets
- In any event, whether terminating by exception or returning, the sentry's destructor is called before leaving this function.
Standard library
The following standard library functions are UnformattedOutputFunction**s**.
basic_ostream::operator<<(basic_streambuf*)basic_ostream::putbasic_ostream::writebasic_ostream::flush
basic_ostream::tellp (except calls pubseekoff instead of output) basic_ostream::seekp (except calls pubseekoff or pubseekpos instead of output) | (since C++11) |
|---|
basic_ostream::tellp(except calls pubseekoff instead of output)basic_ostream::seekp(except calls pubseekoff or pubseekpos instead of output)
(since C++11)
© cppreference.comLicensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

