A FormattedInputFunction is a stream input function that performs the following:
basic_istream::sentry
with automatic storage duration and with the noskipws
argument set to false
, which performs the following 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 ((exceptions() & failbit) != 0
), throws ios_base::failure
. ios_base::skipws
flag is set on this input stream, extracts and discards characters from the input stream until one of the following becomes true: std::ctype
facet of the locale currently imbued in this input stream. The non-whitespace character is not extracted. failbit
and eofbit
are set and if the stream is on for exceptions on one of these bits, ios_base::failure
is thrown. sentry::operator bool()
, which is equivalent to basic_ios::good
. false
or sentry's constructor threw an exception, no input takes place true
, performs the input as if by calling rdbuf()->sbumpc()
or rdbuf()->sgetc()
. rdbuf()->sbumpc()
or rdbuf()->sgetc()
returns Traits::eof()
), sets eofbit
. If exceptions on eofbit
are enabled in this stream's exception mask ((exceptions() & eofbit) != 0
), throws ios_base::failure
. badbit
in the input stream. If exceptions on badbit
are enabled in this stream's exception mask ((exceptions() & badbit) != 0
), the exception is also rethrown. *this
. The following standard library functions are FormattedInputFunctions.
basic_istream::operator>>(int, long, double, void*, bool)
operator>>(std::basic_istream, char&)
operator>>(std::basic_istream, char*)
operator>>(std::basic_istream, std::bitset)
operator>>(std::basic_istream, std::string)
operator>>
, when called on the return value of std::get_money
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() |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/named_req/FormattedInputFunction