debug shrink_to_fit

François Dumont francois.cppdevs@free.fr
Tue Jun 14 19:41:00 GMT 2011


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 ?

2. This design introduce a new dependency between debug and normal mode 
that we hadn't before. Until now safe containers were inheriting from 
normal ones for no reason and I had plan to remove this inheritance 
relation to avoid ADL side effect with introduction of safe algos. With 
this patch several containers are now proposing protected methods to be 
used by safe implementations. I will have to find an other way to 
workaround this issue...

Regards


On 06/12/2011 05:51 PM, Paolo Carlini wrote:
> ... the below is what I tested and I'm committing. Note that 
> __shrink_to_fit_aux is actually not so simple: being the request non 
> binding, we don't want to do anything if the type isn't copy 
> constructible and the move constructor can throw, whereas, per se, 
> move_if_noexcept would just move in that case. Also, I decided to open 
> code the vector<bool> case, otherwise the generic code for vector 
> would have copied bit-by-bit, horrible performance-wise.
>
> Tested x86_64-linux.
>
> Thanks,
> Paolo.
>
> ////////////////////


-------------- next part --------------
A non-text attachment was scrubbed...
Name: shrink_to_fit.patch
Type: text/x-patch
Size: 464 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110614/cbea715c/attachment.bin>


More information about the Libstdc++ mailing list