C++ named requirements: UnformattedInputFunction

From cppreference.com
< cpp‎ | named req
 
 
C++ named requirements
Basic
Type properties
Library-Wide
Container
Container Elements
Iterator
Stream I/O
UnformattedInputFunction
Formatting
(C++20)
Random Numbers
Concurrency
(C++11)
(C++11)
Other
 

Requirements

An UnformattedInputFunction is a stream input function that performs the following:

  • Constructs an object of type basic_istream::sentry with automatic storage duration and with the noskipws argument set to true, which performs the following
  • if eofbit or badbit are set on the input stream, sets the failbit as well, and if exceptions on failbit are enabled in this input stream's exception mask, throws ios_base::failure.
  • flushes the tie()'d output stream, if applicable
  • Checks the status of the sentry by calling sentry::operator bool(), which is equivalent to basic_ios::good.
  • If the sentry returned false or sentry's constructor threw an exception:
  • sets the number of extracted characters (gcount) in the input stream to zero
  • if the function was called to write to an array of CharT, writes CharT() (the null character) to the first location of the array
  • If the sentry returned true, performs the input as if by calling rdbuf()->sbumpc() or rdbuf()->sgetc().
  • if the end of the stream is reached (the call to rdbuf()->sbumpc() or rdbuf()->sgetc() returns Traits::eof()), sets eofbit. If exceptions on eofbit are enabled in this stream's exception mask, throws ios_base::failure.
  • if an exception is thrown during input, sets badbit in the input stream. If exceptions on badbit are enabled in this stream's exception mask, the exception is also rethrown.
  • If no exception was thrown during input, sets the number of extracted characters (gcount) in the input stream.
  • 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 UnformattedInputFunctions.