Subject: Re: [boost] [poly_collection] Request for comments: fast polymorphic collections
From: Joaquin M LÃ³pez MuÃ±oz (joaquinlopezmunoz_at_[hidden])
Date: 2016-11-19 04:09:43
El 18/11/2016 a las 11:56, Thorsten Ottosen escribiÃ³:
> 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.
Here I don't see an alternative: please note that c.insert(x) can
*never* guarantee no memory allocation because x can be of an as-of-yet
unregistered type, which will force the creation of a new segment etc.
So, we can only provide capacity information for *registered* types,
which is precisely what the exotic definition of capacity() does. Do you
see any other viable definition?
JoaquÃn M LÃ³pez MuÃ±oz