From 6939569362a8c3e2c1b5174962309d0d73152845 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 23 Apr 2008 20:56:08 +0000 Subject: (svn r12855) -Codechange: do not use autoptr's for testing whether certain objects can be build, but check it directly in the pool so we do not have to call destructors in the testing phase. Stations still use the autoptr though. --- src/oldpool.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/oldpool.h') diff --git a/src/oldpool.h b/src/oldpool.h index 46d31e999..e8081fa82 100644 --- a/src/oldpool.h +++ b/src/oldpool.h @@ -292,6 +292,18 @@ protected: { return Tpool->CleaningPool(); } + +public: + /** + * Check whether we can allocate an item in this pool. This to prevent the + * need to actually construct the object and then destructing it again, + * which could be *very* costly. + * @return true if and only if at least ONE item can be allocated. + */ + static inline bool CanAllocateItem() + { + return AllocateRaw() != NULL; + } }; -- cgit v1.2.3-70-g09d2