pool: use size_t for allocated sizes

This commit is contained in:
Danny Robson 2014-12-31 19:07:25 +11:00
parent 1c009b9602
commit 36a80c33a9
2 changed files with 15 additions and 6 deletions

View File

@ -22,6 +22,8 @@
#include "nocopy.hpp"
#include <cstdlib>
namespace util {
template <typename T>
class pool : public nocopy {
@ -33,18 +35,25 @@ namespace util {
node *m_head;
node *m_next;
unsigned int m_capacity;
size_t m_capacity;
public:
pool (unsigned int _capacity);
~pool ();
unsigned int capacity (void) const;
// Data management
template <typename ...Args>
T* acquire (Args&... args);
void release (T *data);
size_t capacity (void) const;
// Indexing
size_t index (const T*) const;
T& operator[] (size_t idx);
const T& operator[] (size_t idx) const;
};
}

View File

@ -55,7 +55,7 @@ namespace util {
template <typename T>
unsigned int
size_t
pool<T>::capacity (void) const
{ return m_capacity; }