prime/include/rstl/rmemory_allocator.hpp

23 lines
437 B
C++
Raw Normal View History

#ifndef _RSTL_RMEMORY_ALLOCATOR_HPP
#define _RSTL_RMEMORY_ALLOCATOR_HPP
#include "types.h"
2022-07-18 22:42:58 +00:00
#include "Kyoto/Alloc/CMemory.hpp"
namespace rstl {
struct rmemory_allocator {
template < typename T >
static void allocate(T*& out, int sz) {
2022-04-11 22:42:08 +00:00
out = reinterpret_cast< T* >(new u8[sz]);
}
template < typename T >
static void deallocate(T* ptr) {
if (ptr != nullptr)
2022-09-21 05:18:07 +00:00
CMemory::Free(ptr);
}
};
} // namespace rstl
#endif