Boost logo

Boost Users :

Subject: Re: [Boost-users] Using hash_range with polymorphism
From: Daniel James (dnljms_at_[hidden])
Date: 2011-12-01 09:46:55


On 1 December 2011 14:05, Daniel James <dnljms_at_[hidden]> wrote:
>
> You should probably be including something representing the dynamic
> type in the hash value, but that depends on how you implement
> 'operator==' for FooList. If you don't then defining 'hash_value'
> doesn't make much sense.

Sorry, that wasn't clear. I meant, "If you don't define operator==
then defining hash_value doesn't make much sense". This is because
'boost::hash' implements a hash value for the equivalence relation
defined by 'std::equal_to'. You need to establish what 'operator=='
does in order to know what 'hash_value' should do.


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