Boost logo

Boost :

From: Daniel James (daniel_james_at_[hidden])
Date: 2008-04-21 16:24:04


On 21/04/2008, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
> Daniel James skrev:
> > An alternative that has some appeal is letting the user specify a
> > policy class to control the bucket count. Although I'm not sure how
> > that would play with the standard.
>
> Poor, probably.
>
> I guess for cases where I know the intergers fall in the range, say,
> [0,64], I can just use vector<optional<unsigned>>.

Thinking about it some more, I could create a trait class for the hash function.

template <class T> struct is_good_hash : public boost::mpl::false_ {};
template <> struct is_good_hash<groovy_hash> : public boost::mpl::true_ {};

And use power of 2 tables when the trait is true.

Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk