1 #include <iostream>
2 #include <parallel_hashmap/phmap_dump.h>
3
dump_load_uint64_uint32()4 void dump_load_uint64_uint32() {
5 phmap::flat_hash_map<uint64_t, uint32_t> mp1 = { {100, 99}, {300, 299} };
6
7 for (const auto& n : mp1)
8 std::cout << n.first << "'s value is: " << n.second << "\n";
9
10 {
11 phmap::BinaryOutputArchive ar_out("./dump.data");
12 mp1.dump(ar_out);
13 }
14
15 phmap::flat_hash_map<uint64_t, uint32_t> mp2;
16 {
17 phmap::BinaryInputArchive ar_in("./dump.data");
18 mp2.load(ar_in);
19 }
20
21 for (const auto& n : mp2)
22 std::cout << n.first << "'s value is: " << n.second << "\n";
23 }
24
dump_load_parallel_flat_hash_map()25 void dump_load_parallel_flat_hash_map() {
26 phmap::parallel_flat_hash_map<uint64_t, uint32_t> mp1 = {
27 {100, 99}, {300, 299}, {101, 992} };
28
29 for (const auto& n : mp1)
30 std::cout << "key: " << n.first << ", value: " << n.second << "\n";
31
32 {
33 phmap::BinaryOutputArchive ar_out("./dump.data");
34 mp1.dump(ar_out);
35 }
36
37 phmap::parallel_flat_hash_map<uint64_t, uint32_t> mp2;
38 {
39 phmap::BinaryInputArchive ar_in("./dump.data");
40 mp2.load(ar_in);
41 }
42
43 for (const auto& n : mp2)
44 std::cout << "key: " << n.first << ", value: " << n.second << "\n";
45 }
46
main()47 int main()
48 {
49 dump_load_uint64_uint32();
50 dump_load_parallel_flat_hash_map();
51 return 0;
52 }
53
54