On Wed, 25 May 2022 at 06:10, François Dumont <frs.dum...@gmail.com> wrote: > > Here is the patch to fix just what is described in PR 105714. > > libstdc++: [_Hashtable] Insert range of types convertible to > value_type PR 105714 > > Fix insertion of range of types convertible to value_type. > > libstdc++-v3/ChangeLog: > > PR libstdc++/105714 > * include/bits/hashtable_policy.h (_ValueTypeEnforcer): 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/105714.cc: > New test. > * testsuite/23_containers/unordered_set/insert/105714.cc: > New test. > > Tested under Linux x64, ok to commit ?
I think "_ConvertToValueType" would be a better name than _ValueTypeEnforcer, and all overloads of _ValueTypeEnforcer can be const. OK with that change, thanks.