From 8e08a1af3fafa30762fee1f0350f9e61601c096e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 May 2023 20:32:43 +0300 Subject: [PATCH] Make iterate_objects const --- source/game/pool.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/game/pool.h b/source/game/pool.h index 6357b86..98c5229 100644 --- a/source/game/pool.h +++ b/source/game/pool.h @@ -74,7 +74,7 @@ protected: void destroy_all(); template - void iterate_objects(const F &); + void iterate_objects(const F &) const; void *prepare_allocate(); void commit_allocate(void *); @@ -101,7 +101,7 @@ public: T *create(Args &&...); template - void iterate_objects(const F &func) + void iterate_objects(const F &func) const { PoolBase::iterate_objects([&func](void *ptr){ func(*static_cast(ptr)); }); } private: @@ -127,7 +127,7 @@ inline Pool &PoolPool::get_pool() template -inline void PoolBase::iterate_objects(const F &func) +inline void PoolBase::iterate_objects(const F &func) const { unsigned block_count = capacity/BLOCK_SIZE; for(unsigned i=0; i