You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm planning to change libstdc++ so that basic_stringbuf(const basic_string&, ios_base::mode) calls get_allocator() on the string parameter for its internal string member. I don't plan to allow changing the allocator after construction.
That seems to be the easiest behaviour to explain, and also to implement.
Extended Description
This doesn't compile:
#include
#include
#include
template
struct Alloc : std::allocator
{
template struct rebind { using other = Alloc; };
Alloc(int id) : id(id) { }
template Alloc(const Alloc& a) : id(a.id) { }
int id;
};
using string = std::basic_string<char, std::char_traits, Alloc>;
using stringbuf = std::basic_stringbuf<char, std::char_traits, Alloc>;
int main()
{
string s(Alloc(1));
stringbuf b(s);
assert( b.str().get_allocator() == s.get_allocator() );
}
The basic_stringbuf constructor default-initializes its basic_string member, which default-initializes its allocator.
The text was updated successfully, but these errors were encountered: