Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-03-15 12:00:46

"Dave Harris" <brangdon_at_[hidden]> wrote in message
| In-Reply-To: <d1409a$kc1$1_at_[hidden]>
| daniel_at_[hidden] (Daniel James) wrote (abridged):

| > If Thorsten writes ptr_unordered_set<base> then there might be a
| > problem with boost::hash<base>. Although it will equally apply to
| > std::equal_to<base>.
| Absolutely. In general when writing hash_value() you need to look at the
| corresponding equality operator. For example:
| bool Derived::operator==( const Base &base ) const {
| if (Base::operator==( base ))
| if (const Derived *p = dynamic_cast( const Derived * >(&base))
| if (m_value == p->m_value)
| return true;
| return false;
| }
| Ideally we look at this and we decide there ought to be something in the
| hash_value which corresponds to the dynamic_cast. But what?

are you saying we don't want to hash a Base* as a void*, but use
object properties instead?


Boost list run by bdawes at, gregod at, cpdaniel at, john at