Template Class BloomFilter

Class Documentation

template<class T, class H = std::hash<T>>
class BloomFilter

a filter of Bloom of m bits and k hashes

Public Functions

BloomFilter(std::size_t m, int k, H h = H())

the empty filter of m bits and k hashes

Pre:

m >= 1 and k >= 1

void insert(const T &x)
Post:

maybe( x )

bool maybe(const T &x) const

false only if x was never inserted

double falsePositiveRate(void) const

the expected false positives after the insertions made

std::size_t bits(void) const
int hashes(void) const

Public Static Functions

static BloomFilter forItems(std::size_t n, double p)

the filter of the best k for n items and the false positives p

Pre:

n >= 1 and 0 < p < 1