How to I count key collisions when using boost::unordered_map?
- by Nikhil
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?