From b6db644ac6751c3ad49f56076c9eae7d09998d9a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 11 Jul 2021 19:43:40 +0200 Subject: [PATCH] Add hasher and comparator for StringIdx. --- server/TracyEvent.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index cae2c83f..edb5ba67 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -95,6 +95,22 @@ private: uint8_t m_idx[3]; }; +struct StringIdxHasher +{ + size_t operator()( const StringIdx& key ) const + { + return charutil::hash( (const char*)&key, sizeof( StringIdx ) ); + } +}; + +struct StringIdxComparator +{ + bool operator()( const StringIdx& lhs, const StringIdx& rhs ) const + { + return memcmp( &lhs, &rhs, sizeof( StringIdx ) ) == 0; + } +}; + class Int24 { public: