Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73662 - sandbox/bloom_filter/trunk/boost/bloom_filter
From: cpp.cabrera_at_[hidden]
Date: 2011-08-11 12:53:53


Author: alejandro
Date: 2011-08-11 12:53:52 EDT (Thu, 11 Aug 2011)
New Revision: 73662
URL: http://svn.boost.org/trac/boost/changeset/73662

Log:
Bug fix:

    - Created typedef for apply_hash metafunction for basic
      two_hash filters.
    - Corrected error that resulted in 1 less hash value being
      calculated.
Text files modified:
   sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_basic_bloom_filter.hpp | 10 ++++++----
   sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_counting_bloom_filter.hpp | 4 ++--
   sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_dynamic_basic_bloom_filter.hpp | 10 ++++++----
   3 files changed, 14 insertions(+), 10 deletions(-)

Modified: sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_basic_bloom_filter.hpp
==============================================================================
--- sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_basic_bloom_filter.hpp (original)
+++ sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_basic_bloom_filter.hpp 2011-08-11 12:53:52 EDT (Thu, 11 Aug 2011)
@@ -52,6 +52,10 @@
                                          HashFunction2,
                                          ExtensionFunction> this_type;
 
+ private:
+ typedef detail::twohash_apply_hash<HashValues,
+ this_type> apply_hash_type;
+
     public:
       //* constructors
       twohash_basic_bloom_filter()
@@ -120,8 +124,7 @@
       //* core ops
       void insert(const T& t)
       {
- detail::twohash_apply_hash<HashValues - 1,
- this_type>::insert(t, bits);
+ apply_hash_type::insert(t, bits);
       }
 
       template <typename InputIterator>
@@ -134,8 +137,7 @@
 
       bool probably_contains(const T& t) const
       {
- return detail::twohash_apply_hash<HashValues - 1,
- this_type>::contains(t, bits);
+ return apply_hash_type::contains(t, bits);
       }
 
       void clear()

Modified: sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_counting_bloom_filter.hpp
==============================================================================
--- sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_counting_bloom_filter.hpp (original)
+++ sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_counting_bloom_filter.hpp 2011-08-11 12:53:52 EDT (Thu, 11 Aug 2011)
@@ -91,7 +91,7 @@
       typedef typename bucket_type::const_iterator bucket_const_iterator;
 
     private:
- typedef detail::twohash_counting_apply_hash<HashValues - 1,
+ typedef detail::twohash_counting_apply_hash<HashValues,
                                                   this_type> apply_hash_type;
 
     public:
@@ -157,7 +157,7 @@
       double false_positive_rate() const
       {
         const double n = static_cast<double>(this->count());
- static const double k = static_cast<double>(num_hash_functions());
+ static const double k = static_cast<double>(HashValues);
         static const double m = static_cast<double>(NumBins);
         static const double e =
           2.718281828459045235360287471352662497757247093699959574966;

Modified: sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_dynamic_basic_bloom_filter.hpp
==============================================================================
--- sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_dynamic_basic_bloom_filter.hpp (original)
+++ sandbox/bloom_filter/trunk/boost/bloom_filter/twohash_dynamic_basic_bloom_filter.hpp 2011-08-11 12:53:52 EDT (Thu, 11 Aug 2011)
@@ -55,6 +55,10 @@
 
       static const size_t default_size = 32;
 
+ private:
+ typedef detail::twohash_apply_hash<HashValues,
+ this_type> apply_hash_type;
+
     public:
       //* constructors
       twohash_dynamic_basic_bloom_filter()
@@ -121,8 +125,7 @@
       //* core ops
       void insert(const T& t)
       {
- detail::twohash_apply_hash<HashValues - 1,
- this_type>::insert(t, bits);
+ apply_hash_type::insert(t, bits);
       }
 
       template <typename InputIterator>
@@ -135,8 +138,7 @@
 
       bool probably_contains(const T& t) const
       {
- return detail::twohash_apply_hash<HashValues - 1,
- this_type>::contains(t, bits);
+ return apply_hash_type::contains(t, bits);
       }
 
       void clear()


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk