Have a good hash function for a C++ hash table?

前端 未结 9 1129
鱼传尺愫
鱼传尺愫 2020-12-12 18:15

I am in need of a performance-oriented hash function implementation in C++ for a hash table that I will be coding. I looked around already and only found questions asking wh

9条回答
  •  庸人自扰
    2020-12-12 18:38

    Since C++11, C++ has provided a std::hash< string >( string ). That is likely to be an efficient hashing function that provides a good distribution of hash-codes for most strings.

    Furthermore, if you are thinking of implementing a hash-table, you should now be considering using a C++ std::unordered_map instead.

提交回复
热议问题