Boost logo

Boost :

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)
cost down
at the expense of increasing the average free space not used on on one
of both
sides when the other side gets exhausted.

Joaquín M López Muñoz

Boost list run by bdawes at, gregod at, cpdaniel at, john at