Index: include/private/SkTDArray.h |
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h |
index d6ef3a3834141d4d1ee14021617926169fdfbe4b..f71d3570056bc33a414ab8171a8ab788dbb37297 100644 |
--- a/include/private/SkTDArray.h |
+++ b/include/private/SkTDArray.h |
@@ -217,6 +217,18 @@ public: |
} |
} |
+ template <typename S> int select(S&& selector) const { |
herb_g
2016/08/29 14:39:50
Select in many other languages usually returns ALL
|
+ const T* iter = fArray; |
+ const T* stop = fArray + fCount; |
+ |
+ for (; iter < stop; iter++) { |
+ if (selector(*iter)) { |
+ return SkToInt(iter - fArray); |
+ } |
+ } |
+ return -1; |
herb_g
2016/08/29 14:39:50
I agree with Mike. I think that count is a better
|
+ } |
+ |
int find(const T& elem) const { |
const T* iter = fArray; |
const T* stop = fArray + fCount; |