summaryrefslogtreecommitdiffstats
path: root/source/core/slang-list.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-list.h')
-rw-r--r--source/core/slang-list.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/core/slang-list.h b/source/core/slang-list.h
index 7c96e3844..597f1b9b6 100644
--- a/source/core/slang-list.h
+++ b/source/core/slang-list.h
@@ -192,6 +192,18 @@ public:
Index getCount() const { return m_count; }
Index getCapacity() const { return m_capacity; }
+ template<typename Predicate>
+ Index countIf(Predicate predicate) const
+ {
+ Index count = 0;
+ for (Index i = 0; i < getCount(); ++i)
+ {
+ if (predicate((*this)[i]))
+ count++;
+ }
+ return count;
+ }
+
const T* getBuffer() const { return m_buffer; }
T* getBuffer() { return m_buffer; }