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

Feature request: Heterogeneous overloads for insertion. #62

Open
BenKaufmann opened this issue May 8, 2024 · 2 comments
Open

Feature request: Heterogeneous overloads for insertion. #62

BenKaufmann opened this issue May 8, 2024 · 2 comments

Comments

@BenKaufmann
Copy link
Contributor

tsl::hopscotch_map already provides heterogeneous overloads for lookup (e.g. via find or at) but there is currently no such support for adding elements (e.g. via operator[] or try_emplace). AFAIK, corresponding overloads were added to
the standard associative containers with C++26.

@Tessil Do you think it makes sense to also extend tsl::hopscotch_map? From what I can see, it seems that the underlying tsl::hopscotch_hash already has the necessary functionality, so I drafted a first version for try_emplace and operator[] here. I only extended tsl::hopscotch_map as tsl::bhopscotch_map seems to sometimes copy keys anyways.

If you think this makes sense, I could also open a PR.

@BenKaufmann
Copy link
Contributor Author

I created #63 just in case you think it could be useful.

@Tessil
Copy link
Owner

Tessil commented May 10, 2024

Thank you for the contribution, I'll try to take a look this weekend.

I didn't know it'd be part of C++26, I'll check a bit the proposal.

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

2 participants