27 Feb
2010
27 Feb
'10
7:33 p.m.
On 27 February 2010 19:21, André Santee
I know it has probably been asked a million times here, but I couldn't find any example that I could use. I want to create an unordered_map whose key is an object that I made (vector2), what's the best way of implementing a hash function to it? Can I have an example?
You need to implement 'hash_value' so that Boost.Hash can hash your custom type, take a look at the last example in: http://www.boost.org/doc/html/unordered/hash_equality.html#unordered.hash_eq... It's pretty much what you want. There's more info in the Boost.Hash documentation: http://www.boost.org/doc/html/hash/custom.html Daniel