8#ifndef GrHashMapWithCache_DEFINED
9#define GrHashMapWithCache_DEFINED
29template <
typename K,
typename V,
typename KeyTraits,
typename HashT = SkGoodHash>
33 int count()
const {
return fMap.count(); }
43 if (
key != fLastKey) {
45 fLastValue = fMap.find(
key);
53 if (fLastValue &&
key == fLastKey) {
54 *fLastValue = std::move(val);
57 fLastValue = fMap.set(std::move(
key), std::move(val));
66 fLastKey = std::move(
key);
68 fMap.remove(fLastKey);
73 fLastKey = KeyTraits::GetInvalidKey();
80 mutable K fLastKey = KeyTraits::GetInvalidKey();
81 mutable V* fLastValue =
nullptr;
size_t approxBytesUsed() const
const V * set(K key, V val)
const V * find(const K &key) const
T __attribute__((ext_vector_type(N))) V
static uint32_t CheapMix(uint32_t hash)
uint32_t operator()(uint32_t val)