From 3c8e6cc25e414fed9dbaadef6fed9cc7efaf3068 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 31 Mar 2020 12:03:53 +0200 Subject: Optimize start lookup --- minicc.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'minicc.h') 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& p) const noexcept + { + size_t h0 {std::hash{}(p.first)}; + size_t h1 {std::hash{}(p.second)}; + return h0 ^ (h1 << 1); + } +}; -- cgit v1.2.3