2022-04-10 00:17:06 +00:00
|
|
|
#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"
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
namespace rstl {
|
|
|
|
struct rmemory_allocator {
|
|
|
|
template < typename T >
|
2022-08-26 03:46:24 +00:00
|
|
|
static void allocate(T*& out, s32 sz) {
|
2022-04-11 22:42:08 +00:00
|
|
|
out = reinterpret_cast< T* >(new u8[sz]);
|
2022-04-10 00:17:06 +00:00
|
|
|
}
|
|
|
|
template < typename T >
|
|
|
|
static void deallocate(T* ptr) {
|
|
|
|
if (ptr != nullptr)
|
|
|
|
delete ptr;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace rstl
|
|
|
|
|
|
|
|
#endif
|