Fixed memory pool code

This commit is contained in:
Guilhem Lavaux 2012-05-21 14:19:36 -04:00
parent 80951b4b52
commit 604b19ce74

View File

@ -15,11 +15,13 @@ namespace CosmoTool
PoolNode<T> *next;
};
template<typename T> class MemoryPool;
template<typename T>
class MemoryIterator
{
private:
friend class MemoryPool<T>;
friend class MemoryPool<T>;
PoolNode<T> *cur, *previous;
uint32_t in_node;
@ -41,7 +43,7 @@ namespace CosmoTool
in_node = i.in_node;
}
bool MemoryIterator::operator==(const MemoryIterator& i) const
bool operator==(const MemoryIterator& i) const
{
return (cur == i.cur) && (in_node == i.in_node);
}
@ -82,7 +84,7 @@ namespace CosmoTool
private:
uint32_t m_allocSize;
PoolNode<T> *head, *current;
typedef typename MemoryIterator<T> iterator;
typedef MemoryIterator<T> iterator;
public:
MemoryPool(uint32_t allocSize)
: m_allocSize(allocSize), head(0), current(0) {}