MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
gid.h
Go to the documentation of this file.
1#pragma once
2
3#include <absl/container/flat_hash_map.h>
4#include <absl/container/flat_hash_set.h>
5#include <absl/container/node_hash_map.h>
6#include <absl/container/node_hash_set.h>
7#include <fe/hash.h>
8
9namespace mim {
10
11template<class T>
12struct GIDHash {
13 constexpr size_t operator()(T p) const noexcept { return fe::hash(p->gid()); }
14};
15
16template<class T>
17struct GIDLt {
18 constexpr bool operator()(T a, T b) const noexcept { return a->gid() < b->gid(); }
19};
20
21// clang-format off
22/// @name GID
23///@{
24template<class K, class V> using GIDMap = absl::flat_hash_map<K, V, GIDHash<K>>;
25template<class K> using GIDSet = absl::flat_hash_set<K, GIDHash<K>>;
26template<class K, class V> using GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>>;
27template<class K> using GIDNodeSet = absl::node_hash_set<K, GIDHash<K>>;
28///@}
29// clang-format on
30
31} // namespace mim
Definition ast.h:16
absl::flat_hash_map< K, V, GIDHash< K > > GIDMap
Definition gid.h:24
absl::node_hash_set< K, GIDHash< K > > GIDNodeSet
Definition gid.h:27
absl::node_hash_map< K, V, GIDHash< K > > GIDNodeMap
Definition gid.h:26
absl::flat_hash_set< K, GIDHash< K > > GIDSet
Definition gid.h:25
constexpr size_t operator()(T p) const noexcept
Definition gid.h:13
constexpr bool operator()(T a, T b) const noexcept
Definition gid.h:18