[patch] No allocation for empty unordered containers

Jonathan Wakely jwakely@redhat.com
Wed Aug 13 09:50:00 GMT 2014


On 12/08/14 21:53 +0200, François Dumont wrote:
>On 12/08/2014 21:39, Marc Glisse wrote:
>>On Tue, 12 Aug 2014, François Dumont wrote:
>>
>>>   Based on your feedbacks I think we should stay with just 
>>>targeting good QoI by not allocating on default construction. As I 
>>>said the noexcept qualification would need to not conform strictly 
>>>to the Standard.
>>
>>The standard explicitly says that you may add noexcept wherever you 
>>like. It is constexpr that we can only add in GNU mode.
>>
>    That's not what I meant. For unordered containers there is no real 
>default constructor. it is in fact a constructor with parameters which 
>have all default values. This is why you can only say that it won't 
>throw at runtime and so you can't qualify it noexcept.

Yes you can, it's conforming to replace a (non-virtual) member function
with default arguments by two or more member functions. We do it all
the time.

See 17.6.5.5 [member.functions] p2.



More information about the Libstdc++ mailing list