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,6 +15,8 @@ namespace CosmoTool
PoolNode<T> *next; PoolNode<T> *next;
}; };
template<typename T> class MemoryPool;
template<typename T> template<typename T>
class MemoryIterator class MemoryIterator
{ {
@ -41,7 +43,7 @@ namespace CosmoTool
in_node = i.in_node; 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); return (cur == i.cur) && (in_node == i.in_node);
} }
@ -82,7 +84,7 @@ namespace CosmoTool
private: private:
uint32_t m_allocSize; uint32_t m_allocSize;
PoolNode<T> *head, *current; PoolNode<T> *head, *current;
typedef typename MemoryIterator<T> iterator; typedef MemoryIterator<T> iterator;
public: public:
MemoryPool(uint32_t allocSize) MemoryPool(uint32_t allocSize)
: m_allocSize(allocSize), head(0), current(0) {} : m_allocSize(allocSize), head(0), current(0) {}