169. Bad efficiency of overflow() mandated

Section: [stringbuf.virtuals] Status: TC1 Submitter: Dietmar Kühl Opened: 1999-07-20 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View other active issues in [stringbuf.virtuals].

View all other issues in [stringbuf.virtuals].

View all issues with TC1 status.


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 [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 [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.