prime/include/rstl/rmemory_allocator.hpp
Luke Street 0f25a3c8d4 Migrate s32->int, u32->uint; fix dolphin/types.h
Former-commit-id: 7eb08b6ee832f11971da0cfdc53b5a55b74ac79d
2022-09-05 00:01:22 -04:00

23 lines
429 B
C++

#ifndef _RSTL_RMEMORY_ALLOCATOR_HPP
#define _RSTL_RMEMORY_ALLOCATOR_HPP
#include "types.h"
#include "Kyoto/Alloc/CMemory.hpp"
namespace rstl {
struct rmemory_allocator {
template < typename T >
static void allocate(T*& out, int sz) {
out = reinterpret_cast< T* >(new u8[sz]);
}
template < typename T >
static void deallocate(T* ptr) {
if (ptr != nullptr)
delete ptr;
}
};
} // namespace rstl
#endif