#ifndef CLASSPOOL_H
#define CLASSPOOL_H
// Override memory allocation for a specific class
#include // for size_t
class ClassPool {
public:
enum { MAX_MEMORY = 5 };
ClassPool();
~ClassPool();
static void* operator new (size_t size);
static void operator delete (void* p);
static void release_all();
private:
static void release(void* p);
static void* allocate_from_pool(size_t size);
static bool empty;
static int next;
static void* pool[MAX_MEMORY];
};
#endif CLASSPOOL_H