Boost logo

Boost Users :

Subject: Re: [Boost-users] Using hash_range with polymorphism
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-12-01 10:10:15


Kelvin Chung wrote:

> // It would be nice to have a template that does this so I don't have to
> do this for every leaf class
> std::size_t hash_value(const Foo1& foo1) { return foo1.hash(); }

You don't need to define hash_value for the leaf classes, only for the base
class.

std::size_t hash_value(const Foo& foo) { return foo.hash(); }


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