UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StlAllocator.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if (defined(__AUTORTFM) && __AUTORTFM)
6
7#include "ExternAPI.h"
8
9#include <cstddef>
10
11namespace AutoRTFM
12{
13
14// A stl-compatible allocator which allocates with AutoRTFM::Allocate() and
15// frees with AutoRTFM::Free().
16// TODO(SOL-7652): Remove this once HashMap has been replaced with a bespoke
17// hashmap implementation.
18template <typename T>
19class StlAllocator
20{
21public:
22 using value_type = T;
23
24 StlAllocator() = default;
25
26 template <typename U>
28
29 T* allocate(size_t Count)
30 {
31 return static_cast<T*>(AutoRTFM::Allocate(Count * sizeof(T), alignof(T)));
32 }
33
34 void deallocate(T* Pointer, size_t)
35 {
36 AutoRTFM::Free(Pointer);
37 }
38};
39
40template <typename T, typename U>
42{
43 return true;
44}
45
46template <typename T, typename U>
48{
49 return false;
50}
51
52} // AutoRTFM
53
54#endif // (defined(__AUTORTFM) && __AUTORTFM)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
Definition API.cpp:57
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501