UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SetUtilities.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
8#include "Templates/Tuple.h"
10
14template <typename T> struct TIsTSet { enum { Value = false }; };
15
21template<typename ElementType,typename InKeyType,bool bInAllowDuplicateKeys = false>
30
34template<typename ElementType,bool bInAllowDuplicateKeys /*= false*/>
35struct DefaultKeyFuncs : BaseKeyFuncs<ElementType,ElementType,bInAllowDuplicateKeys>
36{
39
44 {
45 return Element;
46 }
47
52 {
53 return A == B;
54 }
55
59 template<typename ComparableKey>
61 {
62 return A == B;
63 }
64
67 {
68 return GetTypeHash(Key);
69 }
70
72 template<typename ComparableKey>
74 {
75 return GetTypeHash(Key);
76 }
77};
78
81template<typename T>
82inline void MoveByRelocate(T& A, T& B)
83{
84 // Destruct the previous value of A.
85 A.~T();
86
87 // Relocate B into the 'hole' left by the destruction of A, leaving a hole in B instead.
89}
90
95{
96public:
98 constexpr UE_FORCEINLINE_HINT FSetElementId() = default;
99
102 {
103 return Index != INDEX_NONE;
104 }
105
108 {
109 return A.Index == B.Index;
110 }
112 {
113 return A.Index != B.Index;
114 }
115
117 {
118 return Index;
119 }
120
125
126private:
129
132 : Index(InIndex)
133 {
134 }
135};
136
137// This is just an int32
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_INTRINSIC_TYPE_LAYOUT(T)
Definition MemoryLayout.h:760
void MoveByRelocate(T &A, T &B)
Definition SetUtilities.h:82
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition SetUtilities.h:95
UE_FORCEINLINE_HINT friend bool operator!=(const FSetElementId &A, const FSetElementId &B)
Definition SetUtilities.h:111
static UE_FORCEINLINE_HINT FSetElementId FromInteger(int32 Integer)
Definition SetUtilities.h:121
constexpr UE_FORCEINLINE_HINT FSetElementId()=default
constexpr UE_FORCEINLINE_HINT int32 AsInteger() const
Definition SetUtilities.h:116
UE_FORCEINLINE_HINT friend bool operator==(const FSetElementId &A, const FSetElementId &B)
Definition SetUtilities.h:107
UE_FORCEINLINE_HINT bool IsValidId() const
Definition SetUtilities.h:101
U16 Index
Definition radfft.cpp:71
Definition SetUtilities.h:23
TCallTraits< ElementType >::ParamType ElementInitType
Definition SetUtilities.h:26
InKeyType KeyType
Definition SetUtilities.h:24
@ bAllowDuplicateKeys
Definition SetUtilities.h:28
TCallTraits< InKeyType >::ParamType KeyInitType
Definition SetUtilities.h:25
Definition SetUtilities.h:36
static UE_FORCEINLINE_HINT bool Matches(KeyInitType A, KeyInitType B)
Definition SetUtilities.h:51
static UE_FORCEINLINE_HINT uint32 GetKeyHash(ComparableKey Key)
Definition SetUtilities.h:73
TTypeTraits< ElementType >::ConstPointerType KeyInitType
Definition SetUtilities.h:37
static UE_FORCEINLINE_HINT uint32 GetKeyHash(KeyInitType Key)
Definition SetUtilities.h:66
static UE_FORCEINLINE_HINT KeyInitType GetSetKey(ElementInitType Element)
Definition SetUtilities.h:43
static UE_FORCEINLINE_HINT bool Matches(KeyInitType A, ComparableKey B)
Definition SetUtilities.h:60
TCallTraits< ElementType >::ParamType ElementInitType
Definition SetUtilities.h:38
TCallTraitsParamTypeHelper< T, PassByValue >::ParamType ParamType
Definition UnrealTypeTraits.h:275
Definition SetUtilities.h:14
@ Value
Definition SetUtilities.h:14
TCallTraits< T >::ConstPointerType ConstPointerType
Definition UnrealTypeTraits.h:337