[Bug libstdc++/14245] problem with user-defined allocators in std::basic_string
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Wed Feb 25 15:43:00 GMT 2004
------- Additional Comments From pcarlini at suse dot de 2004-02-25 15:43 -------
... of course I really meant 21.3.1, p5.
Anyway, via the second argument passed to _M_dataplus we are *already* using
the copy constructor to initialize the underlying _Alloc.
What should be improved (notice, *improved* as a QoI issue, the current
behavior is standard conforming) is what we do for the first argument:
_M_grab (basing on _Alloc(), and __str.get_allocator()) either calls
_M_refcopy or _M_clone(__alloc1), that is _M_clone(_Alloc()), that is does
*not* use the allocator of the new string!
In my opinion, we should first copy construct the allocator from __str, then
either _M_refcopy or _M_clone (therefore allocate memory) via the allocator
itself, the one of the string being constructed.
Agreed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14245
More information about the Gcc-bugs
mailing list