From 799f334fa7908188442b2510e8ae3721004ea147 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Wed, 27 Jul 2016 21:43:09 +0200 Subject: [PATCH] Using unique_ptr instead of raw pointers in object pool --- src/ObjectPool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ObjectPool.h b/src/ObjectPool.h index 2219088..3e80a2f 100644 --- a/src/ObjectPool.h +++ b/src/ObjectPool.h @@ -9,7 +9,7 @@ class ObjectPool { public: using ptr_type = std::unique_ptr>; - ObjectPool(std::function createObject) : + ObjectPool(std::function()> createObject) : createObject(createObject) {} @@ -19,7 +19,7 @@ public: std::lock_guard lock(poolMutex); if (pool.empty()) { - pool.push(std::unique_ptr(createObject())); + pool.push(createObject()); } ptr_type tmp(pool.top().release(), [this](T* p) {