Index: src/core/SkTDynamicHash.h |
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h |
index 0e34270e0b459765f705405e85106706c48a9a9d..c9a0b3ed01cfaa24cb3851f8fe9cd5c2125af2dd 100644 |
--- a/src/core/SkTDynamicHash.h |
+++ b/src/core/SkTDynamicHash.h |
@@ -12,10 +12,13 @@ |
#include "SkTemplates.h" |
#include "SkTypes.h" |
+// Traits requires: |
+// static const Key& GetKey(const T&) { ... } |
+// static uint32_t Hash(const Key&) { ... } |
+// We'll look on T for these by default, or you can pass a custom Traits type. |
template <typename T, |
typename Key, |
- const Key& (GetKey)(const T&), |
- uint32_t (Hash)(const Key&), |
+ typename Traits = T, |
int kGrowPercent = 75> // Larger -> more memory efficient, but slower. |
class SkTDynamicHash { |
public: |
@@ -227,6 +230,9 @@ private: |
return (index + round + 1) & this->hashMask(); |
} |
+ static const Key& GetKey(const T& t) { return Traits::GetKey(t); } |
+ static uint32_t Hash(const Key& key) { return Traits::Hash(key); } |
+ |
int fCount; // Number of non Empty(), non Deleted() entries in fArray. |
int fDeleted; // Number of Deleted() entries in fArray. |
int fCapacity; // Number of entries in fArray. Always a power of 2. |