A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../named_req/FormattedOutputFunction.html below:

C++ named requirements: FormattedOutputFunction - cppreference.com

[edit] Requirements

A FormattedOutputFunction is a member function of std::basic_ostream or a non-member function involving std::basic_ostream that performs the following operations:

  1. Constructs an object sentry of type std::basic_ostream::sentry.
  2. If bool(sentry) is true, attempts to perform the desired output by inserting the characters into the output stream as if by calling rdbuf()->sputc(). Other public members of std::basic_ostream may also be used, but virtual members of rdbuf() except overflow(), xsputn() and sync() will never be called.
  3. Destroys sentry and returns *this.

If sentry fails to be constructed, or bool(sentry) is false, no output takes place.

If the output could not be generated, calls setstate(std::ios_base::failbit), which can throw an exception.

If an exception is thrown during output, then std::ios_base::badbit is set in *this’s error state without causing a std::ios_base::failure to be thrown. If exceptions on badbit are enabled in this stream's exception 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.

[edit] Padding

Formatted output functions determine padding according to std::num_put::do_put() stage 3.

(until C++14)

If a formatted output function of a stream os determines padding, it does so as follows.

Given a CharT character sequence seq where CharT is the character container type of os, if the length of seq is less than os.width(), then enough copies of os.fill() are added to this sequence as necessary to pad to a width of os.width() characters.

If (os.flags() & std::ios_base::adjustfield) == std::ios_base::left is true, the fill characters are placed after the character sequence; otherwise, they are placed before the character sequence.

(since C++14) [edit] Standard library

The following standard library functions are FormattedOutputFunctions.

except that (given os is an output stream object):
(since C++23) [edit] Defect reports

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 to exceptions() LWG 165 C++98 the only virtual member allowed to be
called on rdbuf() was overflow() also allowed
xsputn() and sync()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4