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

3006. Constructing a basic_stringbuf from a string — where does the allocator come from?

Section: [stringbuf.cons] Status: New Submitter: Marshall Clow Opened: 2017-08-02 Last modified: 2017-11-09

Priority: 3

View other active issues in [stringbuf.cons].

View all other issues in [stringbuf.cons].

View all issues with New status.


Consider the following constructor from [stringbuf.cons] before p3:

explicit basic_stringbuf(
  const basic_string<charT, traits, Allocator>& s,
  ios_base::openmode which = ios_base::in | ios_base::out);

In [stringbuf.cons]/3, it says:

Effects: Constructs an object of class basic_stringbuf, initializing the base class with basic_streambuf() (, and initializing mode with which. Then calls str(s).

But that doesn't mention where the allocator for the basic_stringbuf comes from. Until recently, most implementations just default constructed the allocator. But that requires that the allocator be default constructible.

This bug was filed against libc++ for this case.

I think that the basic_stringbuf should be constructed with a copy of the allocator from the string.

[2017-11-01, Marshall comments]

There exist two related proposals, namely P0407R1 and P0408R2.

[2017-11 Albuquerque Wednesday night issues processing]

Priority set to 3

Proposed resolution: