[英]c++ combine hash functions using std::bitset
I recently came across a blog https://worldengineer.me/2015/02/08/combining-container-hashes-with-c14-metaprogramming-cure-for-insomnia-1729/我最近看到一个博客https://worldengineer.me/2015/02/08/combining-container-hashes-with-c14-metaprogramming-cure-for-insomnia-1729/
Where the author combines two hashes by reducing them to their std::bitset representation and concatenating the bitsets and finding the hash of the combined bitset.作者通过将两个散列减少到它们的 std::bitset 表示并连接位集并找到组合位集的散列来组合两个散列。
Granted that probably the motive of the article was to introduce c++ 14 features, i was wondering how good this approach is compared to say, the boost hash_combine function purely on the basis of collision resistance?当然,这篇文章的动机可能是介绍 c++ 14 的特性,我想知道这种方法与纯粹基于抗碰撞性的 boost hash_combine 函数相比有多好?
EDIT:编辑:
By good i mean how does it fare in avoiding collisions compared to the boost libraries' hash_combine method?我的意思是,与 boost 库的 hash_combine 方法相比,它在避免冲突方面的表现如何? And performance wise is it a good option, though i don't think the above approach should take much longer than the hash_combine method.
性能方面是一个不错的选择,尽管我认为上述方法不会比 hash_combine 方法花费更长的时间。
I am not doing any serious development with this, just prodding around so just wanted to know the merit of the approach.我没有对此进行任何认真的开发,只是四处游荡,所以只是想知道这种方法的优点。
I would say that我会这样说
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.