ktprime / emhash

Fast and memory efficient c++ flat hash map/set
MIT License
435 stars 30 forks source link

fixed emhash8::find(key) ambiguous call #15

Closed shines77 closed 1 year ago

shines77 commented 1 year ago

Signed-off-by: GuoXH gz_shines@msn.com

修正 /hashmap-benchmark/bench/time_hash_map 的这个错误:

/home/git/hashmap-benchmark/bench/time_hash_map/time_hash_map_func.hpp:26:47: error: call to member function 'find' is ambiguous
        r ^= static_cast<std::size_t>(hashmap.find(indices[i]) != hashmap.end());

这里 indices[i] 不是KeyT,而是可以被KeyT的构造函数 KeyT(indices[i]) 构造的类型,所以这里应该统一使用 const K& key,不然会造成"暧昧"call,编译器不知道选择哪个版本。