Subject: Re: [boost] [devector] optimum growing/insertion policy
From: Joaquin M LÃ³pez MuÃ±oz (joaquinlopezmunoz_at_[hidden])
Date: 2017-10-18 09:30:09
El 17/10/2017 a las 15:25, Thorsten Ottosen via Boost escribiÃ³:
> Den 17-10-2017 kl. 14:23 skrev Joaquin M LÃ³pez MuÃ±oz via Boost:
>> This is the tradeoff. I guess
>> your reservation stems from the desire that capacity()-size()
>> indicates the
>> number of insertions before reallocation, to that I just answered Ion
>> in another post.
>> My (current) opinion is that capacity() should not be provided.
> My reservation is not really with capacity(), but with the cost of
> allocation for small flat containers. Last I checked, you could copy
> hundreds of objects for the price of one allocation (and the
> deallocation that is implied).
If your concern is allocation cost and you do not worry that much about
space, you can increase the growing factor G to lower that (amortized)
at the expense of increasing the average free space not used on on one
sides when the other side gets exhausted.
JoaquÃn M LÃ³pez MuÃ±oz