#ifndef STD_MEMORY_H
#define STD_MEMORY_H

#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JKernel/JKRHeap.h"

namespace JGadget {
template <typename T>
struct TAllocator {
    T* allocate(u32 count, const void *param_2) {
        return AllocateRaw(count * sizeof(T));
    }

    T* AllocateRaw(u32 size) {
        return (T*)operator new(size);
    }

    void deallocate(T* mem, u32 size) {
        DeallocateRaw(mem);
    }

    void DeallocateRaw(void* mem) {
        JKR_DELETE(mem);
    }

    void construct(T* p, const T& other) {
        JUT_ASSERT(67, p!=NULL);
        JKR_NEW_ARGS(p) T(other);
    }

    void destroy(T* p) {
        (void)p;
        JUT_ASSERT(68, p!=NULL);
    }

    /* 0x0 */ u8 mAllocator;
};
}

#endif /* STD_MEMORY_H */
