C++ named requirements: UnformattedInputFunction
Requirements
An UnformattedInputFunction is a stream input function that performs the following:
- Constructs an object of type
basic_istream::sentrywith automatic storage duration and with thenoskipwsargument set totrue, which performs the following - if
eofbitorbadbitare set on the input stream, sets thefailbitas well, and if exceptions on failbit are enabled in this input stream's exception mask, throwsios_base::failure. - flushes the tie()'d output stream, if applicable
- Checks the status of the sentry by calling
sentry::operator bool(), which is equivalent tobasic_ios::good. - If the sentry returned
falseor 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, writesCharT()(the null character) to the first location of the array - If the sentry returned
true, performs the input as if by callingrdbuf()->sbumpc()orrdbuf()->sgetc(). - if the end of the stream is reached (the call to
rdbuf()->sbumpc()orrdbuf()->sgetc()returnsTraits::eof(), setseofbit. If exceptions on eofbit are enabled in this stream's exception mask, throwsios_base::failure. - if an exception is thrown during input, sets
badbitin 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.
-
std::getline, except that it does not modify gcount. -
basic_istream::operator>>(basic_streambuf*) -
basic_istream::get -
basic_istream::getline -
basic_istream::ignore -
basic_istream::peek -
basic_istream::read -
basic_istream::readsome -
basic_istream::putback, except that it first clearseofbit -
basic_istream::unget, except that it first clearseofbit -
basic_istream::sync, except that it does not modify gcount -
basic_istream::tellg, except that it does not modify gcount -
basic_istream::seekg, except that it first clearseofbitand does not modify gcount -
std::ws, except that it does not modify gcount
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/named_req/UnformattedInputFunction