1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/common/string_map_set.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/operator/comparison_operators.hpp" |
12 | #include "duckdb/common/types/hash.hpp" |
13 | #include "duckdb/common/types/string_type.hpp" |
14 | #include "duckdb/common/unordered_map.hpp" |
15 | #include "duckdb/common/unordered_set.hpp" |
16 | |
17 | namespace duckdb { |
18 | |
19 | struct StringHash { |
20 | std::size_t operator()(const string_t &k) const { |
21 | return Hash(val: k); |
22 | } |
23 | }; |
24 | |
25 | struct StringEquality { |
26 | bool operator()(const string_t &a, const string_t &b) const { |
27 | return Equals::Operation(left: a, right: b); |
28 | } |
29 | }; |
30 | |
31 | template <typename T> |
32 | using string_map_t = unordered_map<string_t, T, StringHash, StringEquality>; |
33 | |
34 | using string_set_t = unordered_set<string_t, StringHash, StringEquality>; |
35 | |
36 | } // namespace duckdb |
37 |