In Issue #80, it was reported that Heterogenious lookup did not work properly.
I found that this bug occurs under the following conditions.
User specializes std::hash
User is using robin_hood::hash
Since robin_hood::hash inherits from std::hash, it was expected that operator() of std::hash<Key> would be called when a type other than Key is passed to operator() of robin_hood::hash<Key>.
However, it turns out that operator() of std::hash is hidden by operator() of robin_hood::hash.
In Issue #80, it was reported that Heterogenious lookup did not work properly. I found that this bug occurs under the following conditions.
std::hash
robin_hood::hash
Since
robin_hood::hash
inherits fromstd::hash
, it was expected thatoperator()
ofstd::hash<Key>
would be called when a type other thanKey
is passed tooperator()
ofrobin_hood::hash<Key>
. However, it turns out thatoperator()
ofstd::hash
is hidden byoperator()
ofrobin_hood::hash
.cf.)
What I would like to do with this pull request
Correctly call
operator()
ofstd::hash
inoperator()
ofrobin_hood::hash
.Specific proposals
robin_hood::hash::operator()
is currently declared as follows.I would like to replace the above declaration with the one below. Also add an enabler to check if the intended
operator()
is defined instd::hash<T>
.Comments on Issue #80
The reason why the first comment in #80 works is that it is possible to convert from
std::string_view
tostd::string
.On the other hand, the following comment does not work because the conversion from
std::string_view
toboost::beast::static_string<N>
is impossible.Related issues
Closes #80