Index: base/containers/mru_cache.h |
diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h |
index ed1ad251a2f607ee0b2a8f0384d9368474f4cf54..4bacf68cb58cf40f7a44fb5a94e978896a8ec383 100644 |
--- a/base/containers/mru_cache.h |
+++ b/base/containers/mru_cache.h |
@@ -16,6 +16,7 @@ |
#ifndef BASE_CONTAINERS_MRU_CACHE_H_ |
#define BASE_CONTAINERS_MRU_CACHE_H_ |
+#include <algorithm> |
#include <list> |
#include <map> |
#include <utility> |
@@ -137,6 +138,14 @@ class MRUCacheBase { |
return index_iter->second; |
} |
+ // Exchanges the contents of |this| by the contents of the |other|. |
+ void Swap(MRUCacheBase& other) { |
+ ordering_.swap(other.ordering_); |
+ index_.swap(other.index_); |
+ std::swap(deletor_, other.deletor_); |
+ std::swap(max_size_, other.max_size_); |
+ } |
+ |
// 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) { |