[patch] No allocation for empty unordered containers
François Dumont
frs.dumont@gmail.com
Thu Aug 14 19:23:00 GMT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 14871 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20140814/de35584b/attachment.bin>
More information about the Libstdc++
mailing list