debug shrink_to_fit
Jonathan Wakely
jwakely.gcc@gmail.com
Tue Jun 14 20:04:00 GMT 2011
On 14 June 2011 20:40, François Dumont wrote:
> Thanks for having taken care of it and sorry for having misunderstood your
> proposition, I was indeed surprised to be free to change shrink_to_fit
> signature, I know why now.
>
> I have however some remarks:
>
> 1. Attached you will find a small patch that fix a mistake from the original
> patch that was missing state full allocator management:
>
> 2011-06-14 François Dumont <francois.cppdevs@free.fr>
>
> * include/bits/allocator.h (__shrink_to_fit_aux::_S_do_it): Pass
> source instance allocator to destination.
>
> Ok to apply ?
Does it pass the testsuite? (please always state so in patch submissions)
It's not quite as simple as that, I'm not sure whether it should use
allocator_traits::select_on_container_copy_construction() there
instead, and a stateful allocator may not be exchanged by the swap,
potentially copying all the elements twice, making shrink_to_fit very
slow!
More information about the Libstdc++
mailing list