[patch] No allocation for empty unordered containers

François Dumont frs.dumont@gmail.com
Sat Aug 30 18:03:00 GMT 2014


Any news for my patch proposals ?

Regarding documentation of default minimum number of buckets, I don't 
know where it has been documented but why do we need to document it 
separately ? Could it be taken care by Doxygen ? Can't it get the 
default value from the code itself ? If not we could document it ourself 
next to the code rather than in a distinct file.

François

On 14/08/2014 21:22, François Dumont wrote:
> On 13/08/2014 11:50, Jonathan Wakely wrote:
>>
>> 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.
>>
>>
>     You should have told it sooner ! But of course no-one is supposed 
> to ignore the Standard :-).
>
>     Then here is the patch to introduce default constructor with 
> compiler computed noexcept qualification. Note that I also made 
> allocator aware default constructor allocation free however noexcept 
> qualification has to be manually written which I find quite a burden. 
> Do you think we shall do so now ?
>
> 2014-08-14  François Dumont <fdumont@gcc.gnu.org>
>
>     * include/bits/hashtable_policy.h (_Prime_rehash_policy): Qualify 
> constructor
>     noexcept.
>     (_Hash_code_base<>): All specialization default constructible if
>     possible.
>     (_Hashtable_base<>): Likewise.
>     * include/bits/hashtable.h (_Hashtable<>()): Implementation 
> defaulted.
>     * include/bits/unordered_map.h (unordered_map<>::unordered_map()): 
> New,
>     implementation defaulted.
>     (unordered_multimap<>::unordered_multimap()): Likewise.
>     * include/bits/unordered_set.h
>     (unordered_set<>::unordered_set()): Likewise.
>     (unordered_multiset<>::unordered_multiset()): Likewise.
>     * include/debug/unordered_map: Likewise.
>     * include/debug/unordered_set: Likewise.
>     * testsuite/23_containers/unordered_map/allocator/noexcept.cc
>     (test04()): New.
>     * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc
>     (test04()): New.
>     * testsuite/23_containers/unordered_set/allocator/noexcept.cc
>     (test04()): New.
>     * testsuite/23_containers/unordered_multiset/allocator/noexcept.cc
>     (test04()): New.
>
> I am preparing a patch for profile mode so I will submit modification 
> for this mode with this big patch.
>
> Tested under Linux x86_64.
>
> Ok to commit ?
>
> François



More information about the Libstdc++ mailing list