|
|
|
Contents |
AFormattedOutputFunction is a member function ofstd::basic_ostream or a non-member function involvingstd::basic_ostream that performs the following operations:
Ifsentry fails to be constructed, orbool(sentry) isfalse, no output takes place.
If the output could not be generated, callssetstate(std::ios_base::failbit), which can throw an exception.
If an exception is thrown during output, thenstd::ios_base::badbit is set in*this’s error state without causing astd::ios_base::failure to be thrown. If exceptions onbadbit
are enabled in this stream'sexception mask (i.e.,(exceptions()& badbit)!=0), the exception is also rethrown.
When an exception is thrown from the formatted output function,sentry is also destroyed before leaving the function.
Formatted output functions determine padding according tostd::num_put::do_put() stage 3. | (until C++14) |
If a formatted output function of a streamos determines padding, it does so as follows. Given a If(os.flags()&std::ios_base::adjustfield)==std::ios_base::left istrue, the fill characters are placed after the character sequence; otherwise, they are placed before the character sequence. | (since C++14) |
The following standard library functions areFormattedOutputFunctions.
operator<<
, when called on the return value ofstd::put_money(since C++17) |
| (since C++23) |
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 160 | C++98 | the process of determining whether the exception caught is rethrown mentioned a non-existing function exception() | corrected toexceptions() |
LWG 165 | C++98 | the only virtual member allowed to be called onrdbuf() was overflow() | also allowedxsputn() andsync() |