Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      C++ named requirements:UnformattedOutputFunction

      From cppreference.com
      <cpp‎ |named req
       
       
      C++ named requirements
       

      [edit]Requirements

      AUnformattedOutputFunction is a stream output function that performs the following:

      1) Constructs an object of typebasic_ostream::sentry with automatic storage duration, which performs the following:
      • Ifeofbit orbadbit are set on the output stream, sets thefailbit as well, and if exceptions onfailbit are enabled in this output stream'sexception mask ((exceptions()& failbit)!=0), throwsios_base::failure.
      • Flushes the tie()'d output stream, if applicable.
      2) Checks the status of the sentry by callingsentry::operator bool(), which is equivalent tobasic_ios::good.
      • If the operator returnsfalse or sentry's constructor throws an exception, no output takes place.
      • If the operator returnstrue, attempts to perform the desired output by inserting the characters into the output stream as if by callingrdbuf()->sputc(). Other public members ofstd::basic_ostream may also be used, but virtual members ofrdbuf() exceptoverflow(),xsputn() andsync() will never be called.
      • If an exception is thrown during output, setsbadbit in the output stream. If exceptions onbadbit are enabled in this stream'sexception mask ((exceptions()& badbit)!=0), the exception is also rethrown.
      • If no exception was thrown, returns the value specified by the function.
      3) In any event, whether terminating by exception or returning, the sentry's destructor is called before leaving this function.

      [edit]Standard library

      The following standard library functions areUnformattedOutputFunctions.

      (since C++11)

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 63C++98the exception-handling policy was missingadded
      LWG 160C++98the process of determining whether the exception caught
      is rethrown mentioned a non-existing functionexception()
      corrected toexceptions()
      LWG 165C++98the only virtual member allowed to be
      called onrdbuf() wasoverflow()
      also allowed
      xsputn() andsync()
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/named_req/UnformattedOutputFunction&oldid=179589"

      [8]ページ先頭

      ©2009-2025 Movatter.jp