12 May
2011
12 May
'11
2:21 p.m.
On 12 May 2011 11:58, Dominik Steenken
i am having a bit of a problem using boost/hash in combination with boost/shared_ptr. Essentially, what i want when i hash a shared_ptr object is to hash the object it points to.
That's incorrect because 'boost::hash' is intended to be used with 'operator=='. For shared_ptr, operator== compares the pointer, so boost::hash should hash the pointer, not the object it points to. If you want to do that, you need to create your own custom hash function, although you could use Boost.Hash to implement it.