How to I count key collisions when using boost::unordered_map?
Posted
by
Nikhil
on Stack Overflow
See other posts from Stack Overflow
or by Nikhil
Published on 2011-01-16T08:51:11Z
Indexed on
2011/01/16
8:53 UTC
Read the original article
Hit count: 201
boost
I have a data structure with 15 unsigned longs, I have defined a hash function using hash_combine as follows:
friend std::size_t hash_value(const TUPLE15& given)
{
std::size_t seed = 0;
boost::hash_combine(seed, val1);
boost::hash_combine(seed, val2);
...
return seed;
}
I insert a large number of values into a boost::unordered_map but the performance is not good enough. Probably, I could do better with an alternative hashing function. To confirm this, I need to check how many collisions I am getting. How do I do this?
© Stack Overflow or respective owner