pool: use size_t for allocated sizes
This commit is contained in:
parent
1c009b9602
commit
36a80c33a9
15
pool.hpp
15
pool.hpp
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user