Boost logo

Boost :

Subject: Re: [boost] Boost.Bloom_filter now in Sandbox (WAS Re: Interest in a Bloom Filter?)
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2009-06-10 05:15:51


On Tue, Jun 9, 2009 at 11:40 PM, Dean Michael
Berris<mikhailberis_at_[hidden]> wrote:
> On Tue, Jun 9, 2009 at 8:10 PM, Sebastian
> Redl<sebastian.redl_at_[hidden]> wrote:
>
>> The
>> request was for a bloom filter whose size is set at construction time.
>> This is useful e.g. because it allows the user of some filtering tool to
>> trade memory for reliability via a configuration file instead of having
>> to recompile.
>>
>
> Agreed. Then I'll implement a dynamically sized bloom filter, maybe
> call it dynamic_bloom_filter that uses a Boost.Dynamic_bitset
> internally.
>
> Thanks for pointing out my oversight.
>

And as of revision 53785 of the Boost Sandbox, boost::bloom_filter<>
now has the following template parameters:

  template <class Input, class Sequence, class Block, class Allocator>
    struct bloom_filter;

Sequence is a Fusion-compliant sequence of hash functions. The default
parameter is a set of three pre-seeded hash functions which are an
improved version of the earlier boost::detail::default_hash<Size>
type.

Block is the type used by the underlying Boost.Dynamic_bitset
allocated by Allocator.

Now a bloom_filter can just be defined as:

  bloom_filter<int> bf(2048); // 2048 is the number of bits to store,
a runtime value

The default bloom_filter has three functions, all specializations of
the boost::detail::default_hash<Size> type (namely default_hash<0>,
default_hash<1>, default_hash<2>).

HTH

-- 
Dean Michael Berris | Software Engineer, Friendster, Inc.
blog.cplusplus-soup.com | twitter.com/mikhailberis |
linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis |
deanberris.com

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