From fe31b387e8af8584846d51a7ff5b05fbef761162 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Thu, 10 Aug 2017 16:58:48 +1000 Subject: [PATCH] hash: use std::hash for string hashing --- src/util/hash.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/util/hash.h b/src/util/hash.h index 1c35d20c..60bc670a 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -35,6 +35,7 @@ #define UTIL_HASH_H #include +#include #include #include @@ -123,10 +124,16 @@ struct ue2_hash::value>::type> { } }; -/** \brief Hash for any container type that supports std::begin(). */ +/** + * \brief Hash for any container type that supports std::begin(). + * + * We exempt std::string as std::hash is provided and quicker. + */ template -struct ue2_hash::value && - !has_hash_member::value>::type> { +struct ue2_hash::value && + !std::is_same::type, std::string>::value && + !has_hash_member::value>::type> { size_t operator()(const T &obj) const { size_t v = 0; for (const auto &elem : obj) {