16#ifndef AEONGAMES_MEMORYPOOL_H
17#define AEONGAMES_MEMORYPOOL_H
28 constexpr const std::size_t
operator ""_kb (
unsigned long long int aKyloBytes )
30 return aKyloBytes * 1024;
36 constexpr const std::size_t
operator ""_mb (
unsigned long long int aMegaBytes )
38 return aMegaBytes * 1024_kb;
44 constexpr const std::size_t
operator ""_gb (
unsigned long long int aGigaBytes )
46 return aGigaBytes * 1024_mb;
60 DLL
MemoryPool (
size_t sizeOfEachBlock,
size_t numOfBlocks );
66 uint8_t * AddrFromIndex (
size_t i )
const;
67 size_t IndexFromAddr (
const uint8_t* p )
const;
70 size_t mNumOfFreeBlocks;
71 size_t mNumOfInitializedBlocks;
72 std::vector<uint8_t> mMemory;
DLL void * Allocate()
Allocate a block from the pool.
DLL MemoryPool(size_t sizeOfEachBlock, size_t numOfBlocks)
Construct a memory pool.
DLL void DeAllocate(void *p)
Return a block to the pool.
<- This is here just for the literals