Honeycomb
0.1
Component-Model Framework
|
A space-efficient probabilistic data structure that is used to test set membership. Can be tuned to use less space at the expense of increased false positive probabilty. More...
#include <BloomFilter.h>
Public Types | |
typedef BitSet_< Block, Alloc > | BitSet |
Public Member Functions | |
BloomFilter (szt elemCount, Double errorProb=0.01, const Alloc &a=Alloc()) | |
void | insert (const T &obj) |
Insert element into set. More... | |
bool | contains (const T &obj) const |
Check if element is in the set, may return false positive. More... | |
void | clear () |
Remove all elements from the set. More... | |
Double | errorProb () const |
Get false positive probability. More... | |
const BitSet & | bits () const |
Get underlying bit array. More... | |
A space-efficient probabilistic data structure that is used to test set membership. Can be tuned to use less space at the expense of increased false positive probabilty.
At 1% false positive chance each element uses about 9.6 bits, a further 4.8 bits decreases the error chance ten-fold. By comparison unordered_set uses about 20 bytes per element.
Note that the elements themselves aren't stored in the bloom filter, and further, elements can't be removed once added.
typedef BitSet_<Block, Alloc> honey::BloomFilter< T, Block, Alloc >::BitSet |
|
inline |
elemCount | Number of elements expected to be inserted into the set |
errorProb | Probability that contains() will return true even though the element hasn't actually been inserted into the set |
a |
|
inline |
Get underlying bit array.
|
inline |
Remove all elements from the set.
|
inline |
Check if element is in the set, may return false positive.
|
inline |
Get false positive probability.
|
inline |
Insert element into set.