From ed45d19f725aeaed8f4514fa583cd262ae79bb1f Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Fri, 6 Feb 2015 10:20:20 +0200 Subject: [PATCH] cql3: Add std::hash for column_identifier It's needed for unordered_map. Signed-off-by: Pekka Enberg --- cql3/column_identifier.hh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cql3/column_identifier.hh b/cql3/column_identifier.hh index 624fad3368..28b643d466 100644 --- a/cql3/column_identifier.hh +++ b/cql3/column_identifier.hh @@ -180,12 +180,6 @@ public: } #if 0 - @Override - public final int hashCode() - { - return text.hashCode(); - } - @Override public final boolean equals(Object o) { @@ -199,6 +193,8 @@ public: virtual sstring to_string() const { return _text; } + + friend std::hash; }; }; @@ -218,6 +214,12 @@ struct hash { } }; +template<> +struct hash { + size_t operator()(const cql3::column_identifier::raw& r) const { + return std::hash()(r._text); + } +}; }