diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2020-05-23 14:49:42 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2020-05-23 15:54:16 +0300 |
commit | fa2559b3f076e9cfd94db55a30cbb5087e45afec (patch) | |
tree | 50d763872cb03d0cdd249bd83017b128b0f1b11f /server/TracyEvent.hpp | |
parent | 670a292416599ed20a8b5685b1faba5458344d4f (diff) |
Add StringRef hasher, comparator.
Diffstat (limited to 'server/TracyEvent.hpp')
-rw-r--r-- | server/TracyEvent.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 9e536f9a..f4ad85de 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -44,6 +44,22 @@ struct StringRef }; }; +struct StringRefHasher +{ + size_t operator()( const StringRef& key ) const + { + return charutil::hash( (const char*)&key, sizeof( StringRef ) ); + } +}; + +struct StringRefComparator +{ + bool operator()( const StringRef& lhs, const StringRef& rhs ) const + { + return memcmp( &lhs, &rhs, sizeof( StringRef ) ) == 0; + } +}; + class StringIdx { public: |