This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: debug shrink_to_fit


On 14 June 2011 21:32, François Dumont wrote:
> On 06/14/2011 10:03 PM, Jonathan Wakely wrote:
>>
>> 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!
>>
> Yes, it passes shrink_to_fit tests on linux x86_64.
>
> I will read more about this select_on_container_copy_constructor I do not
> know so far.

See the container requirements in the C++0x FDIS.

I am in the process of updating the containers to use the allocator
propagation traits, so it's not supported yet.  As Paolo says, let's
not worry about supporting stateful allocators yet.  Your suggestion
isn't sufficient, and the rest of the propagation support isn't
finished yet so a complete solution isn't possible.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]