Hi there,
In libstdc++/ext/pb_ds , I noticed that the (automatic) resize function for
gp_hash_table does copy-and-destruct operations on old key-value pair (from the
line resize_no_store_hash_fn_imps.hpp:58). Meanwhile, cc_hash_table simply
moves the old pair as expected.
So for gp_hash_table, this strategy makes it impossible to have non-copyable
values, e.g. __gnu_pbds::gp_hash_table<int, std::unique_ptr<int>>. And there
exists potential bugs for scenarios like, keeping a gp_hash_table<int,
std::list<int>> and saving some iterators of those lists elsewhere for quick
access to specific elements in lists.
There could be some workarounds like using std::shared_ptr<T> as value type,
but not so perfect.
I wonder if this is caused by some implementation difficulty or just a small
bug?
Yours,
chhc