|
Boost : |
Subject: Re: [boost] [GSoC] Request for Feedback on Boost.Bloom Filter Project
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2011-06-27 07:35:15
Alejandro Cabrera write:
> Arash Partow wrote:
>> Looks ok, but one important question - Why is the BF typed? Its not
>> necessary and in fact there are many use-cases where one might want to
>> insert and/or test membership for a range of different types using the
>> same BF - all that those types require are that they be hashable.
>>
>
> Though not necessary, I believe having a typed BF is safer. If there are
> users that want to eschew type safety to allow operations on multiple types,
> I believe this can be accomplished either by using a Bloom filter that
> accepts insertions of type void *.
Hmm, it's not clear to me how exactly you would do that with void*. I
think Arash's suggestion is better, and you can then build
strongly-typed filters on top of the "any" version like this:
class bloom_filter_any {
template <typename T>
void insert(const T& val) { .... }
....
};
template <typename T>
class bloom_filter: bloom_filer_any {
void insert(const T& val) { bloom_filter_any::insert(val); }
....
};
Regards, Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk