1 #include <bf/bloom_filter/basic.h>
9 auto ln2 = std::log(2);
10 return std::ceil(-(capacity * std::log(fp) / ln2 / ln2));
15 auto frac =
static_cast<double>(cells) / static_cast<double>(capacity);
16 return std::ceil(frac * std::log(2));
20 : hasher_(std::move(h)),
28 auto required_cells =
m(fp, capacity);
29 auto optimal_k =
k(required_cells, capacity);
30 bits_.
resize(required_cells);
31 hasher_ = make_hasher(optimal_k, seed, double_hashing);
35 : hasher_(std::move(other.hasher_)),
36 bits_(std::move(other.bits_))
42 for (
auto d : hasher_(o))
48 for (
auto d : hasher_(o))
49 if (! bits_[d % bits_.
size()])
61 for (
auto d : hasher_(o))
68 swap(hasher_, other.hasher_);
69 swap(bits_, other.bits_);