[PATCH] Hashtable consider all initializer_list on insertion
François Dumont
frs.dumont@gmail.com
Tue Sep 1 12:18:16 GMT 2020
When I commit the small series of patches on _Hashtable I realize that I
miss a part on the one regarding reservation management on range
insertion. I've added a comment saying that we consider that all
initializer_list elements will be inserted.
For the moment it is true only for assignement operator, this patch
makes it true for constructor and insert methods. In the insert method
we "reserve" only if container is empty cause otherwise we can't be that
sure that all elements will be inserted even if the users made its best
for that.
The consequence is that silly initialization in the tests are not
working anymore.
libstdc++: Hashtable: Consider that all initializer_list elements
are inserted
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h
(_Insert_base<>::_M_initialize): New.
(_Insert_base<>::insert(initializer_list<value_type>)): Adapt, use
latter.
* include/bits/hashtable.h
(_Hashtable(initializer_list<value_type>, size_type, const
_H1&,
const key_equal&, const allocator_type&)): Likewise.
(_Hashtable<>::operator=(initializer_list<value_type>)): Likewise.
* testsuite/23_containers/unordered_set/cons/bucket_hint.cc
(test02):
New.
* testsuite/23_containers/unordered_set/init-list.cc
(test01): Remove.
* testsuite/23_containers/unordered_set/modifiers/insert.cc
(test01):
Remove.
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: 5173 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200901/9eca27d6/attachment.bin>
More information about the Libstdc++
mailing list