Permalink
Browse files

ironbeepp/memory_manager: Extend implicit conversions to ScopedMemory…

…Pool and ScopedMemoryPoolLite.
  • Loading branch information...
1 parent 5aef4af commit cb87b0c77c0660131240e31261c2c319cff32d8a Christopher Alfeld committed Feb 26, 2014
Showing with 19 additions and 0 deletions.
  1. +7 −0 include/ironbeepp/memory_manager.hpp
  2. +12 −0 ironbeepp/memory_manager.cpp
@@ -40,7 +40,9 @@
namespace IronBee {
class MemoryPool;
+class ScopedMemoryPool;
class MemoryPoolLite;
+class ScopedMemoryPoolLite;
/**
* Memory Manager; equivalent to a *value* of @ref ib_mm_t.
@@ -87,6 +89,11 @@ class MemoryManager
MemoryManager(MemoryPool memory_pool);
//! Conversion from MemoryPoolLite. Implicit.
MemoryManager(MemoryPoolLite memory_pool_lite);
+ //! Conversion from ScopedMemoryPool. Implicit.
+ MemoryManager(ScopedMemoryPool& memory_pool);
+ //! Conversion from ScopedMemoryPoolLite. Implicit.
+ MemoryManager(ScopedMemoryPoolLite& memory_pool_lite);
+
///@}
@@ -107,12 +107,24 @@ MemoryManager::MemoryManager(MemoryPool memory_pool) :
// nop
}
+MemoryManager::MemoryManager(ScopedMemoryPool& memory_pool) :
+ m_ib(ib_mm_mpool(MemoryPool(memory_pool).ib()))
+{
+ // nop
+}
+
MemoryManager::MemoryManager(MemoryPoolLite memory_pool_lite) :
m_ib(ib_mm_mpool_lite(memory_pool_lite.ib()))
{
// nop
}
+MemoryManager::MemoryManager(ScopedMemoryPoolLite& memory_pool_lite) :
+ m_ib(ib_mm_mpool_lite(MemoryPoolLite(memory_pool_lite).ib()))
+{
+ // nop
+}
+
void* MemoryManager::alloc(size_t size) const
{

0 comments on commit cb87b0c

Please sign in to comment.