From fe98e733191a041053f0c1dab3e6ddb9d39fea29 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Fri, 2 Jul 2021 22:42:24 -0700 Subject: [PATCH] :fire::art::racehorse: removed substr_view after learning string_view::substr is O(1) --- include/xxhash_str.h | 3 ++- src/xxhash_str.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/xxhash_str.h b/include/xxhash_str.h index efd900c..aab219a 100644 --- a/include/xxhash_str.h +++ b/include/xxhash_str.h @@ -4,5 +4,6 @@ struct xxHashStringGen { - XXH64_hash_t operator()(const std::string_view &str) const noexcept; + XXH64_hash_t operator()(const std::string &str) const noexcept; + XXH64_hash_t operator()(std::string_view str) const noexcept; }; diff --git a/src/xxhash_str.cpp b/src/xxhash_str.cpp index a665e23..7816fb6 100644 --- a/src/xxhash_str.cpp +++ b/src/xxhash_str.cpp @@ -1,6 +1,10 @@ #include "xxhash_str.h" -XXH64_hash_t xxHashStringGen::operator()(const std::string_view &str) const noexcept +XXH64_hash_t xxHashStringGen::operator()(const std::string &str) const noexcept { return XXH3_64bits(str.data(), str.size()); } +XXH64_hash_t xxHashStringGen::operator()(std::string_view str) const noexcept +{ + return XXH3_64bits(str.data(), str.size()); +} \ No newline at end of file