Can I hash a container? #249
-
Is there a way to hash a container? I can see that this listed as "future work" in #19, and I wanted to know if that was done/how to do it. I can see that Failing that, is there some way to stably iterate over the elements in a container such that I can construct my own law-abiding hash value? I don't care too badly about performance, but allocating a vector or something just to sort it feels wrong. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can define override |
Beta Was this translation helpful? Give feedback.
You can define override
std::hash
and define it by iterating over the container, hashing every element and combining the hashes (using something likeboost:::hash_combine
or your own hash combination formula).