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

Heterogeneous lookup #72

Closed gergondet closed 4 years ago

gergondet commented 4 years ago

This PR implements heterogeneous lookup in robin_hood::unordered_set and robin_hood::unordered_map.

As hinted in #39 this is based on P1690R0 which means it is enabled if both the provided Hash and KeyEqual types have an is_transparent tag.

I've also added heterogeneous "overloads" for count and contains

A unit test is added to check the newly added code and that no conversion happens thanks to the heterogeneous lookup.

martinus commented 4 years ago

Thanks a lot for this!