OLD | NEW |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
1 #ifndef SkTHash_DEFINED | 8 #ifndef SkTHash_DEFINED |
2 #define SkTHash_DEFINED | 9 #define SkTHash_DEFINED |
3 | 10 |
| 11 #include "SkChecksum.h" |
4 #include "SkTypes.h" | 12 #include "SkTypes.h" |
5 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
6 | 14 |
7 // Before trying to use SkTHashTable, look below to see if SkTHashMap or SkTHash
Set works for you. | 15 // Before trying to use SkTHashTable, look below to see if SkTHashMap or SkTHash
Set works for you. |
8 // They're easier to use, usually perform the same, and have fewer sharp edges. | 16 // They're easier to use, usually perform the same, and have fewer sharp edges. |
9 | 17 |
10 // T and K are treated as ordinary copyable C++ types. | 18 // T and K are treated as ordinary copyable C++ types. |
11 // Traits must have: | 19 // Traits must have: |
12 // - static K GetKey(T) | 20 // - static K GetKey(T) |
13 // - static uint32_t Hash(K) | 21 // - static uint32_t Hash(K) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 235 |
228 private: | 236 private: |
229 struct Traits { | 237 struct Traits { |
230 static const T& GetKey(const T& item) { return item; } | 238 static const T& GetKey(const T& item) { return item; } |
231 static uint32_t Hash(const T& item) { return HashT(item); } | 239 static uint32_t Hash(const T& item) { return HashT(item); } |
232 }; | 240 }; |
233 SkTHashTable<T, T, Traits> fTable; | 241 SkTHashTable<T, T, Traits> fTable; |
234 }; | 242 }; |
235 | 243 |
236 #endif//SkTHash_DEFINED | 244 #endif//SkTHash_DEFINED |
OLD | NEW |