aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-13 14:53:18 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-13 14:53:18 +0000
commitaf07d065d19ec387b783b6dfdc3deafd7c614b69 (patch)
treedf5e5526eab4120f551858d1c041250bd6b469c7
parentfd4c00eb36c9164487bf9e1cea39eaca64a9be91 (diff)
Add SkTDArray.contains(), which is just a wrapper around find()
Review URL: https://codereview.appspot.com/6349103 git-svn-id: http://skia.googlecode.com/svn/trunk@4595 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkTDArray.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h
index 1afd3d08a9..60c987d933 100644
--- a/include/core/SkTDArray.h
+++ b/include/core/SkTDArray.h
@@ -229,6 +229,13 @@ public:
}
/**
+ * Returns true iff the array contains this element.
+ */
+ bool contains(const T& elem) const {
+ return (this->find(elem) >= 0);
+ }
+
+ /**
* Copies up to max elements into dst. The number of items copied is
* capped by count - index. The actual number copied is returned.
*/
@@ -333,4 +340,3 @@ private:
};
#endif
-