Boost logo

Boost Users :

Subject: Re: [Boost-users] [Hash] Custom hash_value for Pointers
From: Daniel James (dnljms_at_[hidden])
Date: 2010-08-27 15:08:55


On 27 August 2010 18:53, Hossein Haeri <powerprogman_at_[hidden]> wrote:
> Dear all,
>
> Should not the program in the P.S. output "I got used!"? If not, how can I ensure that it's size_t hash_value(B*) which gets called upon use of bPtrHasher's operator()?

I don't know, my ADL knowledge is a bit rusty, but you shouldn't be
doing that anyway. 'boost::hash' is designed to be used alongside
'std::equal_to'. For pointers it uses the standard pointer equality
comparison, so 'boost::hash' should be using the standard hash
function to match it. If you want to use a different hash algorithm,
than you should use your own hash class, just as if you wanted to for
integers.

Daniel


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