}
}
- void lru_remove(K key) {
+ void lru_remove(const K& key) {
typename map<K, typename list<pair<K, VPtr> >::iterator>::iterator i =
contents.find(key);
if (i == contents.end())
contents.erase(i);
}
- void lru_add(K key, VPtr val, list<VPtr> *to_release) {
+ void lru_add(const K& key, const VPtr& val, list<VPtr> *to_release) {
typename map<K, typename list<pair<K, VPtr> >::iterator>::iterator i =
contents.find(key);
if (i != contents.end()) {
}
}
- void remove(K key) {
+ void remove(const K& key) {
Mutex::Locker l(lock);
weak_refs.erase(key);
cond.Signal();
assert(weak_refs.empty());
}
- void clear(K key) {
+ void clear(const K& key) {
VPtr val; // release any ref we have after we drop the lock
{
Mutex::Locker l(lock);
return weak_refs.begin()->first;
}
- VPtr lower_bound(K key) {
+ VPtr lower_bound(const K& key) {
VPtr val;
list<VPtr> to_release;
{
return val;
}
- VPtr lookup(K key) {
+ VPtr lookup(const K& key) {
VPtr val;
list<VPtr> to_release;
{
* map, false otherwise
* @return A reference to the map's value for the given key
*/
- VPtr add(K key, V *value, bool *existed = NULL) {
+ VPtr add(const K& key, V *value, bool *existed = NULL) {
VPtr val(value, Cleanup(this, key));
list<VPtr> to_release;
{