martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

Cannot copy elements from one map to another using STL #139

Closed h-2 closed 2 years ago

h-2 commented 2 years ago

Happy new year and thanks for providing this library first of all!

The following fails to build:

    robin_hood::unordered_flat_map<int, int> in;
    robin_hood::unordered_flat_map<int, int> out;

    std::copy(in.begin(), in.end(),
              std::inserter(out, out.begin()));

Error message at godbolt: https://godbolt.org/z/r51z49d5x

h-2 commented 2 years ago

The problem here is that your insert functions return std::pair<iterator, bool> while the insert functions in std::unordered_map and phmap::flat_hash_map etc return just iterator.

slavenf commented 2 years ago

@h-2 Problem is resolved in version 3.11.5.

This issue can be closed.