[Bug libstdc++/56437] basic_string assumes that allocators are default-constructible

tneumann at pi3 dot informatik.uni-mannheim.de gcc-bugzilla@gcc.gnu.org
Mon Feb 25 06:32:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437

--- Comment #3 from Thomas Neumann <tneumann at pi3 dot informatik.uni-mannheim.de> 2013-02-25 06:31:43 UTC ---
(In reply to comment #1)
> This is hardly the only C++11 allocator requirement missing from std::string,
> ALL of the new requirements are missing, and unlikely to be implemented until
> we switch to a non-COW string implementation.

Well, but this would be an allocator requirement that is easy to fix. There are
only three places with "_Alloc()" in basic_string.tcc, and only two would have
to be fixed as far as I can see it.

I am not sure yet why the code even tries to construct the allocator, but if
necessary we could use is_default_constructible to figure out of the
constructor is available. I could try to produce a patch myself if you prefer.
But as of new basic_string is quite unusable with stateful allocators.



More information about the Gcc-bugs mailing list