Boost logo

Boost :

Subject: Re: [boost] [candidate bloom_filter] Default Sequence
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2009-06-11 03:27:21

On Thu, Jun 11, 2009 at 1:36 AM, JOAQUIN M. LOPEZ MUÑOZ<joaquin_at_[hidden]> wrote:
> Currently, the default Sequence template arg is
> class Sequence = fusion::vector<
>            detail::default_hash<0>,
>            detail::default_hash<1>,
>            detail::default_hash<2>
>                >
> which implies the default K is 3. I propose to
> generalize this a bit so that we have something like
> template<typename K>
> default_hash_sequence...;
> such that default_hash_sequence<K> is the fusion
> sequence default_hash<0>,...,default_hash<K-1>
> (I don't know Fusion but I'm sure this can be done) and
> then put
> class Sequence = default_hash_sequence<3>
> So, a user can easily set
> bloom_filter<foo,default_hash_sequence<K> >
> with a K other than 3.

This makes sense, I like it! Why didn't I think of that earlier? :-D

I think I can try my hand at making something like this, or at least
have a metafunction default_hash_sequence_generator<K> that has a
nested ::type that returns the actual fusion sequence. I think I can
do some manual recursion with types, then just reach into it as the
default template parameter:

  template <class Input, class Sequence = typename
default_hash_sequence_generator<3>::type, ...>
  struct bloom_filter;

This should be easily done if I know my Fusion well enough. ;-)

Thanks for the suggestion, let me make this happen sooner than later. :-D

Dean Michael Berris | Software Engineer, Friendster, Inc. | | | |

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