This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.

169. Bad efficiency of overflow() mandated

Section: 27.8.2.4 [stringbuf.virtuals] Status: TC1 Submitter: Dietmar Kühl Opened: 1999-07-20 Last modified: 2016-02-10

Priority: Not Prioritized

View other active issues in [stringbuf.virtuals].

View all other issues in [stringbuf.virtuals].

View all issues with TC1 status.

Discussion:

Paragraph 8, Notes, of this section seems to mandate an extremely inefficient way of buffer handling for basic_stringbuf, especially in view of the restriction that basic_ostream member functions are not allowed to use xsputn() (see 27.7.5.1 [ostream]): For each character to be inserted, a new buffer is to be created.

Of course, the resolution below requires some handling of simultaneous input and output since it is no longer possible to update egptr() whenever epptr() is changed. A possible solution is to handle this in underflow().

Proposed resolution:

In 27.8.2.4 [stringbuf.virtuals] paragraph 8, Notes, insert the words "at least" as in the following:

To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements to hold the current array object (if any), plus at least one additional write position.