summaryrefslogtreecommitdiffhomepage
path: root/minicc.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-03-31 12:03:53 +0200
committerRoland Reichwein <mail@reichwein.it>2020-03-31 12:03:53 +0200
commit3c8e6cc25e414fed9dbaadef6fed9cc7efaf3068 (patch)
treeaace36c9d6ac0302f188f02be55050c82617fbe3 /minicc.h
parent79fbc8bf495770e4a8b7c66c46acf07f4e47e568 (diff)
Optimize start lookup
Diffstat (limited to 'minicc.h')
-rw-r--r--minicc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/minicc.h b/minicc.h
index d3135c6..92678a1 100644
--- a/minicc.h
+++ b/minicc.h
@@ -34,3 +34,12 @@ struct Token {
// For printing via Google Test
bool operator==(const Token &a, const Token &b);
std::ostream& operator<<(std::ostream& os, const Token& token);
+
+struct PairHashSS {
+ size_t operator()(const std::pair<std::string,std::string>& p) const noexcept
+ {
+ size_t h0 {std::hash<std::string>{}(p.first)};
+ size_t h1 {std::hash<std::string>{}(p.second)};
+ return h0 ^ (h1 << 1);
+ }
+};