Try to find entry, and insert default_val if not present. Return a pointer to the value. key should not be null.
| 108 | /// Try to find entry, and insert default_val if not present. Return a pointer to the |
| 109 | /// value. key should not be null. |
| 110 | V* FindOrInsert(const K key, const V& default_val) { |
| 111 | DCHECK_LT(size_, capacity_); |
| 112 | Entry* entry = FindEntry(key); |
| 113 | if (entry->key == NULL) { |
| 114 | entry->key = key; |
| 115 | entry->val = default_val; |
| 116 | ++size_; |
| 117 | } |
| 118 | return &entry->val; |
| 119 | } |
| 120 | |
| 121 | uint32_t size() const { return size_; } |
| 122 |
no outgoing calls