libstdc++: [_Hashtable] Insert range of types convertible to value_type PR 105717
authorFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 15 Feb 2022 08:47:52 +0000 (09:47 +0100)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 15 Jun 2022 18:21:52 +0000 (20:21 +0200)
commitdc9b92facf87a6f2d8b0e5d5fc404f30c3b15a74
tree95c4d41b34dc6e916d89672541364d4deed646af
parent636b01ab4910da0b96d844301fea1a2b56c5344d
libstdc++: [_Hashtable] Insert range of types convertible to value_type PR 105717

Fix insertion of range of instances convertible to value_type.

libstdc++-v3/ChangeLog:

PR libstdc++/105717
* include/bits/hashtable_policy.h (_ConvertToValueType): New.
* include/bits/hashtable.h (_Hashtable<>::_M_insert_unique_aux): New.
(_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, true_type)): Use latters.
(_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, false_type)): Likewise.
(_Hashtable(_InputIterator, _InputIterator, size_type, const _Hash&, const _Equal&,
const allocator_type&, true_type)): Use this.insert range.
(_Hashtable(_InputIterator, _InputIterator, size_type, const _Hash&, const _Equal&,
const allocator_type&, false_type)): Use _M_insert.
* testsuite/23_containers/unordered_map/cons/56112.cc: Check how many times conversion
is done.
* testsuite/23_containers/unordered_map/insert/105717.cc: New test.
* testsuite/23_containers/unordered_set/insert/105717.cc: New test.
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/testsuite/23_containers/unordered_map/cons/56112.cc
libstdc++-v3/testsuite/23_containers/unordered_map/insert/105717.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/insert/105717.cc [new file with mode: 0644]