summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-03-28 01:20:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-03-28 03:00:35 +0000
commit014373a9ef99e4c9cc1c15f52e0946ea413c868d (patch)
tree4c4339ac49add51fbc09fa74b9fe65af9c35cf9b /lib
parentAdd standard special members (diff)
downloadilt-014373a9ef99e4c9cc1c15f52e0946ea413c868d.tar.bz2
ilt-014373a9ef99e4c9cc1c15f52e0946ea413c868d.tar.xz
ilt-014373a9ef99e4c9cc1c15f52e0946ea413c868d.zip
Expose size of each container by type
Diffstat (limited to 'lib')
-rw-r--r--lib/collection.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/collection.h b/lib/collection.h
index 91a36c2..22dcc52 100644
--- a/lib/collection.h
+++ b/lib/collection.h
@@ -35,6 +35,14 @@ public:
return objects[idx];
}
+ template<typename T = Object>
+ requires(std::is_same_v<T, Object> || (std::is_base_of_v<Others, T> || ...))
+ [[nodiscard]] auto
+ size() const noexcept
+ {
+ return containerFor<T>().size();
+ }
+
template<typename T = Object, typename... Params>
auto
create(Params &&... params)