This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
basic_istream::ignore
Section: 31.7.5.4 [istream.unformatted] Status: C++14 Submitter: Krzysztof Żelechowski Opened: 2011-09-11 Last modified: 2016-08-09
Priority: Not Prioritized
View all other issues in [istream.unformatted].
View all issues with C++14 status.
Discussion:
31.7.5.4 [istream.unformatted] in N3242 currently has the following to say about the
semantics of basic_istream::ignore
:
[..]. Characters are extracted until any of the following occurs:
- if
n != numeric_limits<streamsize>::max()
(18.3.2),n
characters are extracted
This statement, apart from being slightly ungrammatical, indicates that if
(n == numeric_limits<streamsize>::max()
), the method returns without
extracting any characters.
[..]. Characters are extracted until any of the following occurs:
(n != numeric_limits<streamsize>::max())
(18.3.2) and (n
) characters have been extracted so far.
[2013-04-20, Bristol]
Resolution: Ready.
[2013-09-29, Chicago]
Apply to Working Paper
Proposed resolution:
This wording is relative to the FDIS.
Change 31.7.5.4 [istream.unformatted] p25 as indicated:
basic_istream<charT,traits>& ignore(streamsize n = 1, int_type delim = traits::eof());-25- Effects: Behaves as an unformatted input function (as described in 31.7.5.4 [istream.unformatted], paragraph 1). After constructing a
sentry
object, extracts characters and discards them. Characters are extracted until any of the following occurs:
ifn != numeric_limits<streamsize>::max()
( [limits.numeric]),andn
charactersarehave been extracted so far- end-of-file occurs on the input sequence (in which case the function calls
setstate(eofbit)
, which may throwios_base::failure
(31.5.4.4 [iostate.flags]));traits::eq_int_type(traits::to_int_type(c), delim)
for the next available input characterc
(in which casec
is extracted).