Index: net/base/linked_hash_map.h |
diff --git a/net/base/linked_hash_map.h b/net/base/linked_hash_map.h |
index b024ca1d5361d46f958051b096d668b61412ce6c..cdfb971cc30182025175d471556a2a29f2159655 100644 |
--- a/net/base/linked_hash_map.h |
+++ b/net/base/linked_hash_map.h |
@@ -124,23 +124,28 @@ class linked_hash_map { |
return 1; |
} |
- // Erases values with the provided iterator. If the provided iterator is |
- // invalid or there is inconsistency between the map and list, a CHECK() error |
- // will occur. |
- void erase(iterator position) { |
+ // Erases the item that 'position' points to. Returns an iterator that points |
+ // to the item that comes immediately after the deleted item in the list, or |
+ // end(). |
+ // If the provided iterator is invalid or there is inconsistency between the |
+ // map and list, a CHECK() error will occur. |
+ iterator erase(iterator position) { |
typename MapType::iterator found = map_.find(position->first); |
CHECK(found->second == position) |
<< "Inconsisent iterator for map and list, or the iterator is invalid."; |
- list_.erase(position); |
map_.erase(found); |
+ return list_.erase(position); |
} |
- // Erases values between first and last, not including last. |
- void erase(iterator first, iterator last) { |
+ // Erases all the items in the range [first, last). Returns an iterator that |
+ // points to the item that comes immediately after the last deleted item in |
+ // the list, or end(). |
+ iterator erase(iterator first, iterator last) { |
while (first != last && first != end()) { |
- erase(first++); |
+ first = erase(first); |
} |
+ return first; |
} |
// Finds the element with the given key. Returns an iterator to the |