#pragma once struct Memory { [[nodiscard]] static void* Allocate(size_t aSize) noexcept; static void Free(void* apData) noexcept; template static T* Allocate() noexcept { auto pMemory = static_cast(Allocate(sizeof(T))); return pMemory; } template static T* New() noexcept { return new (Allocate()) T; } template static T* New(TArgs... args) noexcept { auto pMemory = static_cast(Allocate(sizeof(T))); return new (Allocate()) T(std::forward(args)...); } template static T* NewArray(const size_t aCount) noexcept { auto pMemory = static_cast(Allocate(sizeof(T) * aCount)); for (size_t i = 0; i < aCount; ++i) { new (pMemory[i]) T; } return pMemory; } template static void Delete(T* apMemory) noexcept { assert(apMemory != nullptr); Free(apMemory); } };