Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert overload broken #66

Open
albi-k opened this issue Nov 13, 2024 · 0 comments
Open

insert overload broken #66

albi-k opened this issue Nov 13, 2024 · 0 comments

Comments

@albi-k
Copy link

albi-k commented Nov 13, 2024

The following insert overload appears to be broken in hopscotch_hash:
std::pair<iterator, bool> insert(P&& value)

It seems the issue was the removal of the explicit conversion to value_type from this pull:
#63

Adding it back fixes the issue:
return insert_impl(value_type(std::forward<P>(value)));

Minimal code example to reproduce compilation failure. The same would compile with std::unordered_map.

#include <tsl/hopscotch_map.h>
#include <memory>

class Base {};
class Derived
: public Base {};

int main()
{
    tsl::hopscotch_map<int, std::unique_ptr<Base>> m;
    m.insert( std::make_pair(0, std::make_unique<Derived>()) );
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant