summaryrefslogtreecommitdiff
path: root/common/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/list.h')
-rw-r--r--common/list.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/list.h b/common/list.h
index 2ad41fd..513f79c 100644
--- a/common/list.h
+++ b/common/list.h
@@ -22,10 +22,15 @@ class List : public B {
}
//! Check if specified item is present in list.
- bool contains(T item) {
+ bool contains(const T& item) {
return std::find(B::begin(), B::end(), item) != B::end();
}
+ //! Count number of instances of specified item in list.
+ std::size_t count(const T& item) {
+ return std::count(B::begin(), B::end(), item);
+ }
+
//! Delete item by index.
void del(std::size_t index) {
erase(B::begin() + index);