From eafc5214b25494fcf75793e5c6ffcd36e2aaf271 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 2 Sep 2022 21:25:36 +0200 Subject: Core/Misc: Minor refactor to std::hash specialization for std::pair to avoid showing incorrect documentation in IDEs on entire std namespace --- src/common/Utilities/Hash.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/common/Utilities/Hash.h b/src/common/Utilities/Hash.h index 0486d338a70..b63201bf07a 100644 --- a/src/common/Utilities/Hash.h +++ b/src/common/Utilities/Hash.h @@ -32,20 +32,17 @@ namespace Trinity //! Hash implementation for std::pair to allow using pairs in unordered_set or as key for unordered_map //! Individual types used in pair must be hashable by std::hash -namespace std +template +struct std::hash> { - template - struct hash> +public: + size_t operator()(std::pair const& p) const { - public: - size_t operator()(std::pair const& p) const - { - size_t hashVal = 0; - Trinity::hash_combine(hashVal, p.first); - Trinity::hash_combine(hashVal, p.second); - return hashVal; - } - }; -} + size_t hashVal = 0; + Trinity::hash_combine(hashVal, p.first); + Trinity::hash_combine(hashVal, p.second); + return hashVal; + } +}; #endif // TrinityCore_Hash_h__ -- cgit v1.2.3