From 80fb932ec383a227ce781f9e32b63a7b9af78d94 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Mon, 16 Dec 2024 22:50:59 -0800 Subject: [PATCH] Use reference type for deleter --- src/mesh/MemoryPool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/MemoryPool.h b/src/mesh/MemoryPool.h index 096bf528d..4bda3d50a 100644 --- a/src/mesh/MemoryPool.h +++ b/src/mesh/MemoryPool.h @@ -11,7 +11,7 @@ template class Allocator { public: - Allocator() : deleter([this](T *p) { this->release(p); }) {} + Allocator() : deleter(std::bind(&Allocator::release, this, std::placeholders::_1)) {} virtual ~Allocator() {} /// Return a queable object which has been prefilled with zeros. Panic if no buffer is available @@ -47,7 +47,7 @@ template class Allocator } /// Variations of the above methods that return std::unique_ptr instead of raw pointers. - using UniqueAllocation = std::unique_ptr>; + using UniqueAllocation = std::unique_ptr &>; /// Return a queable object which has been prefilled with zeros. /// std::unique_ptr wrapped variant of allocZeroed(). UniqueAllocation allocUniqueZeroed() { return UniqueAllocation(allocZeroed(), deleter); }