[patch] No allocation for empty unordered containers

Paolo Carlini paolo.carlini@oracle.com
Tue Aug 5 20:23:00 GMT 2014


On 08/05/2014 10:10 PM, Jonathan Wakely wrote:
> It doesn't have to be noexcept, but IMHO there is no point changing
> the containers to avoid allocation unless that allows us to mark it
> noexcept.  If it can throw anyway, we might as well allocate the
> initial buckets.
I have been following this discussion on and off. In general, I must say 
that AFAIK a default constructor which doesn't allocate memory is 
normally considered superior from the QoI point of view, even if isn't 
noexcept. As probably I have already mentioned, a "well known" C++ 
library implementer used to repeat it all the time and used also to say 
that our std::list implementation was very good exactly because of that 
feature, *well* before the invention of noexcept. That said, marking the 
constructor noexcept is of course the obvious next step, I don't have 
much to say about the general development plans we have got here.


More information about the Libstdc++ mailing list