Lines Matching refs:key
51 V ReadVal(const K& key)
54 return map_[key];
58 void ChangeValueByLambda(const K& key, LambdaCallback callback)
61 callback(map_[key]);
96 * @param key Indicates the key of the key-value (KV) pair to insert.
101 bool Insert(const K& key, const V& value)
104 auto ret = map_.insert(std::pair<K, V>(key, value));
111 * @param key Indicates the key of the KV pair to insert.
113 * @note If the key to insert already exists, delete and then insert
116 void EnsureInsert(const K& key, const V& value)
119 auto ret = map_.insert(std::pair<K, V>(key, value));
120 // find key and cannot insert
123 map_.insert(std::pair<K, V>(key, value));
132 * @param Key Indicates the key to search.
137 bool Find(const K& key, V& value)
142 auto iter = map_.find(key);
154 * @param Key Indicates the key of the KV pair.
157 * @return Returns <b>true</b> if the key is replaced;
160 bool FindOldAndSetNew(const K& key, V& oldValue, const V& newValue)
165 auto iter = map_.find(key);
169 map_.insert(std::pair<K, V>(key, newValue));
180 * @param Key Indicates the key of the KV pair to erase.
182 void Erase(const K& key)
185 map_.erase(key);