Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4571,7 +4571,7 @@
that are part of the library.
The semantics of the constructor used in user code is as specified.
\end{footnote}
If \tcode{noskipws} is zero and
If \tcode{noskipws} is \tcode{false} and
\tcode{is.flags() \& ios_base::skipws}
is nonzero, the function extracts and discards each character as long as
the next available input character \tcode{c} is a whitespace character.
Expand All @@ -4585,13 +4585,11 @@
\tcode{setstate(failbit | eofbit)}
(which may throw
\tcode{ios_base::failure}).
After any preparation is completed, \exposid{ok_} is set to the value of \tcode{is.good()}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this describes the final step, I think it would make more sense to be right at the end, after the "During preparation" sentence (maybe as a separate paragraph).

That way the structure would be:

  • The function extracts and discards each whitespace character.
  • If extracting a character returns eof, set failbit|eofbit.
  • Whitespace is determined using ctype.
  • The constructor may set failbit and throw. (for ... reasons? I guess the footnote covers that)
  • After any preparation is completed, set ok_.

What do you think?

Copy link
Contributor Author

@cpplearner cpplearner Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this makes sense if we drop this \remarks macro.

\remarks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, agreed.


\pnum
\remarks
The constructor
\begin{codeblock}
explicit sentry(basic_istream& is, bool noskipws = false)
\end{codeblock}
This constructor
uses the currently imbued locale in \tcode{is},
to determine whether the next input character is
whitespace or not.
Expand All @@ -4600,19 +4598,12 @@
To decide if the character \tcode{c} is a whitespace character,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are here, we can also drop the quote of the constructor signature in the previous paragraph.

Like...it's a Remarks for this constructor. Do we really need to say yet again that we are talking about this constructor?

the constructor performs as if it executes the following code fragment:
\begin{codeblock}
const ctype<charT>& ctype = use_facet<ctype<charT>>(is.getloc());
if (ctype.is(ctype.space, c) != 0)
const ctype<charT>& ct = use_facet<ctype<charT>>(is.getloc());
if (ct.is(ct.space, c))
// \tcode{c} is a whitespace character.
\end{codeblock}

\pnum
If, after any preparation is completed,
\tcode{is.good()}
is
\tcode{true},
\tcode{\exposid{ok_} != false}
otherwise,
\tcode{\exposid{ok_} == false}.
During preparation, the constructor may call
\tcode{setstate(failbit)}
(which may throw
Expand Down