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