Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions include/boost/compute/detail/lru_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class lru_cache

// insert the new item
m_list.push_front(key);
m_map[key] = std::make_pair(value, m_list.begin());
m_map.emplace(key, std::make_pair(value, m_list.begin()));
}
}

Expand All @@ -97,18 +97,10 @@ class lru_cache
m_list.push_front(key);

// update iterator in map
j = m_list.begin();
const value_type &value = i->second.first;
m_map[key] = std::make_pair(value, j);

// return the value
return value;
}
else {
// the item is already at the front of the most recently
// used list so just return it
return i->second.first;
i->second.second = m_list.begin();
}
// return the value
return i->second.first;
}

void clear()
Expand Down