Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2020-05-23 14:49:42 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2020-05-23 15:54:16 +0300
commitfa2559b3f076e9cfd94db55a30cbb5087e45afec (patch)
tree50d763872cb03d0cdd249bd83017b128b0f1b11f /server/TracyEvent.hpp
parent670a292416599ed20a8b5685b1faba5458344d4f (diff)
Add StringRef hasher, comparator.
Diffstat (limited to 'server/TracyEvent.hpp')
-rw-r--r--server/TracyEvent.hpp16
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: