On Fri, 21 Jun 2024, 02:28 CH HC via Gcc, wrote: > 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 std::unique_ptr>. And there exists potential bugs for scenarios like, > keeping a gp_hash_table> 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 as value > type, but not so perfect. > I wonder if this is caused by some implementation difficulty or just a > small bug? > Yours, > chhc > Hi, this question would be more appropriate on the libstdc++@gcc.gnu.org making list. I've Cc'd that list. Please take the gcc list out of any future replies, thanks. The pb_ds code was written pre-C++11 and not updated for move semantics. All that code is completely unmaintained and my preference would be to remove it completely.