Files
2025-10-25 03:02:53 +03:00

46 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[istream.formatted.reqmts]
# 31 Input/output library [[input.output]](./#input.output)
## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#istream.formatted.reqmts)
### 31.7.5 Input streams [[input.streams]](input.streams#istream.formatted.reqmts)
#### 31.7.5.3 Formatted input functions [[istream.formatted]](istream.formatted#reqmts)
#### 31.7.5.3.1 Common requirements [istream.formatted.reqmts]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4655)
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[.](#1.sentence-1)
It then creates an object of classsentry with thenoskipws (second) argumentfalse[.](#1.sentence-2)
If thesentry object returnstrue,
when converted to a value of typebool,
the function endeavors
to obtain the requested input[.](#1.sentence-3)
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[.](#1.sentence-4)
If rdbuf()->sbumpc() or rdbuf()->sgetc() returns traits::eof(), thenios_base::eofbit is set in the local error state and
the input function stops trying to obtain the requested input[.](#1.sentence-5)
If an exception is thrown during input thenios_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[.](#1.sentence-6)
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[.](#1.sentence-7)
In any case, the formatted input function destroys thesentry object[.](#1.sentence-8)
If no exception has been thrown, it returns*this[.](#1.sentence-9)