This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Open status.
stringbuf::underflow()
underspecifiedSection: 31.8.2.5 [stringbuf.virtuals] Status: Open Submitter: Sergey Zubkov Opened: 2013-08-29 Last modified: 2018-06-12
Priority: 4
View other active issues in [stringbuf.virtuals].
View all other issues in [stringbuf.virtuals].
View all issues with Open status.
Discussion:
In 31.8.2.5 [stringbuf.virtuals]/1, basic_stringbuf::underflow()
is specified to unconditionally
return traits::eof()
when a read position is not available.
basic_stringbuf
require, and existing libraries implement it so that this function makes
a read position available if possible to do so, e.g. if some characters were inserted into the stream since the
last call to overflow()
, resulting in pptr() > egptr()
. Compare to the conceptually similar
99 [depr.strstreambuf.virtuals]/15.
[2018-06-06, Billy argues for NAD]
The existing "Any character in the underlying buffer which has been initialized is considered to be part of the input sequence."
sentence already describes what the stringbuf
is supposed to do to the get area. The specific mechanism that the
stringbuf
uses to alter the get area is unspecified because the mechanism by which the stringbuf
remembers the "high water mark" is unspecified.
stringstream s; s << "Hello"; s.seekp(0); string x; s >> x;
Before this P/R, this will store Hello
in x
, because the characters Hello
are initialized.
After this P/R, the "written put area" is empty, so it will store the empty string in x
.
[2018-06 Rapperswil Wednesday issues processing]
Billy to provide rationale for closing as NAD.
Proposed resolution:
This wording is relative to N3691.
Change 31.8.2.5 [stringbuf.virtuals] as indicated:
int_type underflow();-1- Returns: If the input sequence has a read position available or the function makes a read position available (as described below), returns
-?- The function can make a read position available only iftraits::to_int_type(*gptr())
. Otherwise, returnstraits::eof()
. Any character in the underlying buffer which has been initialized is considered to be part of the input sequence.(mode & ios_base::in) != 0
and if the write next pointerpptr()
is not null and is greater than the current read end pointeregptr()
. To make a read position available, the function alters the read end pointeregptr()
to equalpptr()
.