Index: base/containers/mru_cache.h |
diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h |
index e59e909839165e9fd9cd1b1f106e35736ecd01a5..15ea2fccdc4104dfbae4961cc24674c475230771 100644 |
--- a/base/containers/mru_cache.h |
+++ b/base/containers/mru_cache.h |
@@ -123,8 +123,6 @@ class MRUCacheBase { |
// Retrieves the payload associated with a given key and returns it via |
// result without affecting the ordering (unlike Get). |
- // |
- // TODO(brettw) We may want a const version of this function in the future. |
iterator Peek(const KeyType& key) { |
typename KeyIndex::const_iterator index_iter = index_.find(key); |
if (index_iter == index_.end()) |
@@ -132,6 +130,13 @@ class MRUCacheBase { |
return index_iter->second; |
} |
+ const_iterator Peek(const KeyType& key) const { |
+ typename KeyIndex::const_iterator index_iter = index_.find(key); |
+ if (index_iter == index_.end()) |
+ return end(); |
+ return index_iter->second; |
+ } |
+ |
// Erases the item referenced by the given iterator. An iterator to the item |
// following it will be returned. The iterator must be valid. |
iterator Erase(iterator pos) { |