// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #if (defined(__AUTORTFM) && __AUTORTFM) #include "ExternAPI.h" #include namespace AutoRTFM { // A stl-compatible allocator which allocates with AutoRTFM::Allocate() and // frees with AutoRTFM::Free(). // TODO(SOL-7652): Remove this once HashMap has been replaced with a bespoke // hashmap implementation. template class StlAllocator { public: using value_type = T; StlAllocator() = default; template StlAllocator(const StlAllocator&) {}; T* allocate(size_t Count) { return static_cast(AutoRTFM::Allocate(Count * sizeof(T), alignof(T))); } void deallocate(T* Pointer, size_t) { AutoRTFM::Free(Pointer); } }; template bool operator==(const StlAllocator&, const StlAllocator&) { return true; } template bool operator!=(const StlAllocator&, const StlAllocator&) { return false; } } // AutoRTFM #endif // (defined(__AUTORTFM) && __AUTORTFM)