Subject: Re: [boost] [devector] optimum growing/insertion policy
From: Joaquin M LÃ³pez MuÃ±oz (joaquinlopezmunoz_at_[hidden])
Date: 2017-10-18 13:10:27
El 18/10/2017 a las 13:48, Thorsten Ottosen via Boost escribiÃ³:
> Den 18-10-2017 kl. 11:36 skrev Joaquin M LÃ³pez MuÃ±oz via Boost:
>> El 16/10/2017 a las 19:38, Thorsten Ottosen via Boost escribiÃ³:
>>> Maybe this is lost to me in the details, but given code that works
>>> for vector:
>>> Â vector<int> v;
>>> Â ...
>>> Â v.reserve( v.size() + N );
>>> which guarantees no exceptions and no reallocations, how would that
>>> work with your policy?
>> Sorry, now it's me who's lost :-) std::vector::reserve can both throw
>> and reallocate, right?
> Yes, sorry for being unclear, I'm talking about the guarantee given to
> push_back() and insert() of N elements after the call to reserve().
OK, now I get it. Well, my position is that reserve should be replaced by
some mechanism for explicitly controlling free space at each end. Then
can rely on the guarantee that she can do as many as
[back|front]_free_capacity() push_[back|front] ops without rellocation.
JoaquÃn M LÃ³pez MuÃ±oz
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk