From: epoger@google.com Date: Fri, 13 Jul 2012 14:53:18 +0000 (+0000) Subject: Add SkTDArray.contains(), which is just a wrapper around find() X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~15589 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af07d065d19ec387b783b6dfdc3deafd7c614b69;p=platform%2Fupstream%2FlibSkiaSharp.git 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 --- diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h index 1afd3d0..60c987d 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 -