mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
25 lines
303 B
C++
25 lines
303 B
C++
#pragma once
|
|
|
|
#include "../../Globals.h"
|
|
|
|
// pool allocator
|
|
template <class T, int size>
|
|
class Pool
|
|
{
|
|
T pool[size];
|
|
int count;
|
|
public:
|
|
Pool()
|
|
{
|
|
Reset();
|
|
}
|
|
void Reset()
|
|
{
|
|
count=0;
|
|
}
|
|
T* Alloc()
|
|
{
|
|
_dbg_assert_msg_(CPU,count<size-1,"Pool allocator overrun!");
|
|
return &pool[count++];
|
|
}
|
|
};
|