-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
41 lines (34 loc) · 909 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*********************************************************
File Name:main.cpp
Author: Abby Cin
Mail: [email protected]
Created Time: Sun 23 Aug 2020 03:51:10 PM CST
**********************************************************/
#include "bloom.h"
int main()
{
using namespace std::string_view_literals;
using namespace std;
BloomFilter bl { 100, 0.001 };
cout << bl.estimate() << '\n';
vector<string_view> vs;
vs.emplace_back("are");
vs.emplace_back("are you");
vs.emplace_back("are you ok");
vs.emplace_back("are you ok?");
vector<string_view> ha;
ha.emplace_back("are ");
ha.emplace_back("are you ");
ha.emplace_back("are you ok ");
for (auto x : vs) {
bl.add(x);
}
cout << boolalpha;
for (auto x : vs) {
BloomFilter::print(x, "=>", bl.test(x));
}
BloomFilter::print("==========================");
for (auto x : ha) {
BloomFilter::print(x, "=>", bl.test(x));
}
}