|
Boost : |
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk