31 Input/output library [input.output]

31.7 Formatting and manipulators [iostream.format]

31.7.5 Input streams [input.streams]

31.7.5.3 Formatted input functions [istream.formatted]

31.7.5.3.1 Common requirements [istream.formatted.reqmts]

Each formatted input function begins execution by constructing an object of type ios_base​::​iostate, termed the local error state, and initializing it to ios_base​::​goodbit.
It then creates an object of class sentry with the noskipws (second) argument false.
If the sentry object returns true, when converted to a value of type bool, the function endeavors to obtain the requested input.
Otherwise, if the sentry constructor exits by throwing an exception or if the sentry object produces false when converted to a value of type bool, the function returns without attempting to obtain any input.
If rdbuf()->sbumpc() or rdbuf()->sgetc() returns traits​::​eof(), then ios_base​::​eofbit is set in the local error state and the input function stops trying to obtain the requested input.
If an exception is thrown during input then ios_base​::​badbit is set in the local error state, *this's error state is set to the local error state, and the exception is rethrown if (exceptions() & badbit) != 0.
After extraction is done, the input function calls setstate, which sets *this's error state to the local error state, and may throw an exception.
In any case, the formatted input function destroys the sentry object.
If no exception has been thrown, it returns *this.