Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: base/id_map.h

Issue 604048: Correctly recognize emptiness of IDMap. (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/id_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/id_map.h
diff --git a/base/id_map.h b/base/id_map.h
index b108dbd8755f706c49cecd555cac7815e0bf8ba7..acfba42bb94a61b1beeeeb128f2a7abe9090a603 100644
--- a/base/id_map.h
+++ b/base/id_map.h
@@ -82,7 +82,7 @@ class IDMap {
}
bool IsEmpty() const {
- return data_.empty();
+ return size() == 0u;
}
T* Lookup(KeyType id) const {
@@ -93,7 +93,7 @@ class IDMap {
}
size_t size() const {
- return data_.size();
+ return data_.size() - removed_ids_.size();
}
// It is safe to remove elements from the map during iteration. All iterators
« no previous file with comments | « no previous file | base/id_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698