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

Unified Diff: src/core/SkTHash.h

Issue 1058553002: Add SkTHashSet::find() (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: const Created 5 years, 9 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 | tests/HashTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTHash.h
diff --git a/src/core/SkTHash.h b/src/core/SkTHash.h
index 967b9be87835be62b514daef8e13c72959f2fd0a..c4bd3b6161c2dbbbb6beeae1da12f1f869813448 100644
--- a/src/core/SkTHash.h
+++ b/src/core/SkTHash.h
@@ -231,7 +231,11 @@ public:
void add(const T& item) { fTable.set(item); }
// Is this item in the set?
- bool contains(const T& item) const { return SkToBool(fTable.find(item)); }
+ bool contains(const T& item) const { return SkToBool(this->find(item)); }
+
+ // If an item equal to this is in the set, return a pointer to it, otherwise null.
+ // This pointer remains valid until the next call to add().
+ const T* find(const T& item) const { return fTable.find(item); }
private:
struct Traits {
« no previous file with comments | « no previous file | tests/HashTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698