Boost logo

Boost Users :

Subject: Re: [Boost-users] Unwanted implicit conversions to bool
From: Daniel James (dnljms_at_[hidden])
Date: 2011-05-12 10:21:39


On 12 May 2011 11:58, Dominik Steenken <dominik_at_[hidden]> wrote:
>
>  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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net