| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/common/index_map.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/constants.hpp" |
| 12 | #include "duckdb/common/unordered_map.hpp" |
| 13 | #include "duckdb/common/unordered_set.hpp" |
| 14 | |
| 15 | namespace duckdb { |
| 16 | |
| 17 | struct LogicalIndexHashFunction { |
| 18 | uint64_t operator()(const LogicalIndex &index) const { |
| 19 | return std::hash<idx_t>()(index.index); |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | struct PhysicalIndexHashFunction { |
| 24 | uint64_t operator()(const PhysicalIndex &index) const { |
| 25 | return std::hash<idx_t>()(index.index); |
| 26 | } |
| 27 | }; |
| 28 | |
| 29 | template <typename T> |
| 30 | using logical_index_map_t = unordered_map<LogicalIndex, T, LogicalIndexHashFunction>; |
| 31 | |
| 32 | using logical_index_set_t = unordered_set<LogicalIndex, LogicalIndexHashFunction>; |
| 33 | |
| 34 | template <typename T> |
| 35 | using physical_index_map_t = unordered_map<PhysicalIndex, T, PhysicalIndexHashFunction>; |
| 36 | |
| 37 | using physical_index_set_t = unordered_set<PhysicalIndex, PhysicalIndexHashFunction>; |
| 38 | |
| 39 | } // namespace duckdb |
| 40 |