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: [v3] C++11 allocator reqs for vector in debug & profile mode


On 11/14/2011 10:15 PM, Jonathan Wakely wrote:
On 14 November 2011 20:15, François Dumont wrote:
    I wonder if playing with allocator propagation in such a context is
right. The Standard define shrink_to_fit as a member method and not as a
global function. People implementing an allocator might not expect
allocators to be copy or anything else when calling vector::shrink_to_fit
which can normally be implemented without it.
I don't see what being a member function or global function has to do
with anything.

Allocators must be copyable, containers take a copy of an allocator,
if copying them misbehaves then you're in big trouble, long before
calling shrink_to_fit.

Could you explain why you think the current code is a problem?

My change ensures that the new storage is created with the same
allocator, so whether propagate_on_container_swap is true or not, the
container ends up with the same allocator it had originally (or a copy
of it) and storage that can be freed by that allocator.

Just forget my remark, I finally see nothing wrong with this patch. I was still thinking about your remark several weeks ago when I submit the same patch. I though that you would have added checks on propagations flags which you haven't so it is fine.

Sorry for the noise.

François


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