Subject: Re: [boost] [poly_collection] Request for comments: fast polymorphic collections
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2016-11-18 05:56:23
On 16-11-2016 11:54, Thorsten Ottosen wrote:
> On 15-11-2016 23:53, Joaquin M López Muñoz wrote:
>> El 15/11/2016 a las 18:38, Thorsten Ottosen escribió:
>>> D. I don't get the use of numeric_limits<T>::max() for capacity of an
>>> empty container. I would be perfectly happy with 0 unless there is
>>> something we cannot do with that definition.
>> Not a strong opinon on that. Having capacity()==infinite for a
>> segment-less collection makes sense from a mathematical point of view,
>> but other than that 0 could work equally well. If this eventually make
>> it into an official proposal I'd adopt whatever the community thinks
>> makes the most sense.
> ok, it confused me, so chances are that it will confuse the average
> programmer and take up brain cycles for no reason.
It also seems natural to expect that capacity() - size() for a container
to tell us the number of elements I can insert without reallocation will
happen, and hence is important if one want to reason about
exception-safety. With the exotic definition of capacity() that is no
longer the case.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk