UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Set.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6
7namespace uLang
8{
9 class CHeapRawAllocator;
10
11template<class ElementType, class KeyType, class HashTraits, class AllocatorType, typename... AllocatorArgsType>
12class TSetG
13{
14public:
16
18 ULANG_FORCEINLINE bool Contains(const ElementType& Element) const { return _HashTable.Contains(Element); }
19 ULANG_FORCEINLINE ElementType* Find(const KeyType& Key) { return _HashTable.Find(Key); }
20 ULANG_FORCEINLINE const ElementType* Find(const KeyType& Key) const { return _HashTable.Find(Key); }
21
22 template <typename Predicate>
23 ULANG_FORCEINLINE const ElementType* FindByPredicate(Predicate Pred) const
24 {
26 }
27
28 template <typename Predicate>
29 ULANG_FORCEINLINE ElementType* FindByPredicate(Predicate Pred)
30 {
32 }
33
34 template <typename ArgType>
35 ULANG_FORCEINLINE ElementType& Insert(ArgType&& Arg)
36 {
38 }
39
40 ULANG_FORCEINLINE ElementType& FindOrInsert(ElementType&& Element) { return _HashTable.FindOrInsert(ForwardArg<ElementType>(Element)); }
41 ULANG_FORCEINLINE bool Remove(const ElementType& Element) { return _HashTable.Remove(Element); }
42
43 ULANG_FORCEINLINE bool IsEmpty() const { return _HashTable.IsEmpty(); }
44
46
47 using HashTableType = THashTable<ElementType, ElementType, HashTraits, AllocatorType, AllocatorArgsType...>;
48 using ConstIterator = typename HashTableType::template Iterator<true>;
49 using Iterator = typename HashTableType::template Iterator<false>;
50
55
57 {
58 return _HashTable.end();
59 }
60
62 {
63 return _HashTable.cbegin();
64 }
65
67 {
68 return _HashTable.cend();
69 }
70
72 {
73 return _HashTable.cbegin();
74 }
75
77 {
78 return _HashTable.cend();
79 }
80
81protected:
83};
84
85// A set that assumes that the KeyType has a method `GetTypeHash()`, and that allocates memory from the heap
86template<class ElementType, class KeyType = ElementType>
88
89} // namespace uLang
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ULANG_FORCEINLINE
Definition Common.h:188
Raw memory allocator that allocates memory from the global heap.
Definition Allocator.h:64
ULANG_FORCEINLINE uint32_t Num() const
Definition HashTable.h:68
ULANG_FORCEINLINE Iterator< true > cend() const
Definition HashTable.h:374
KeyValueType & Insert(const KeyValueType &KeyValue)
Definition HashTable.h:134
ULANG_FORCEINLINE Iterator< true > cbegin() const
Definition HashTable.h:365
KeyValueType & FindOrInsert(KeyValueType &&KeyValue)
Definition HashTable.h:144
ULANG_FORCEINLINE bool Contains(const KeyType &Key) const
Definition HashTable.h:73
void Empty()
Definition HashTable.h:231
ULANG_FORCEINLINE Iterator< false > end()
Definition HashTable.h:350
ULANG_FORCEINLINE Iterator< false > begin()
Definition HashTable.h:341
ULANG_FORCEINLINE KeyValueType * Find(const KeyType &Key)
Definition HashTable.h:78
bool IsEmpty() const
Definition HashTable.h:226
bool Remove(const KeyType &Key)
Definition HashTable.h:156
const KeyValueType * FindByPredicate(Predicate Pred) const
Definition HashTable.h:99
Definition Set.h:13
ULANG_FORCEINLINE ElementType * Find(const KeyType &Key)
Definition Set.h:19
ULANG_FORCEINLINE ElementType * FindByPredicate(Predicate Pred)
Definition Set.h:29
ULANG_FORCEINLINE uint32_t Num() const
Definition Set.h:17
HashTableType _HashTable
Definition Set.h:82
typename HashTableType::template Iterator< false > Iterator
Definition Set.h:49
ULANG_FORCEINLINE Iterator begin()
Definition Set.h:51
ULANG_FORCEINLINE bool Remove(const ElementType &Element)
Definition Set.h:41
ULANG_FORCEINLINE bool IsEmpty() const
Definition Set.h:43
typename HashTableType::template Iterator< true > ConstIterator
Definition Set.h:48
ULANG_FORCEINLINE Iterator end()
Definition Set.h:56
ULANG_FORCEINLINE const ElementType * FindByPredicate(Predicate Pred) const
Definition Set.h:23
ULANG_FORCEINLINE void Empty()
Definition Set.h:45
ULANG_FORCEINLINE ConstIterator begin() const
Definition Set.h:61
TSetG(AllocatorArgsType &&... AllocatorArgs)
Definition Set.h:15
ULANG_FORCEINLINE ConstIterator end() const
Definition Set.h:66
ULANG_FORCEINLINE const ElementType * Find(const KeyType &Key) const
Definition Set.h:20
ULANG_FORCEINLINE bool Contains(const ElementType &Element) const
Definition Set.h:18
ULANG_FORCEINLINE ElementType & Insert(ArgType &&Arg)
Definition Set.h:35
ULANG_FORCEINLINE ConstIterator cend() const
Definition Set.h:76
ULANG_FORCEINLINE ConstIterator cbegin() const
Definition Set.h:71
ULANG_FORCEINLINE ElementType & FindOrInsert(ElementType &&Element)
Definition Set.h:40
Definition VVMEngineEnvironment.h:23
ULANG_FORCEINLINE TRemoveReference< T >::Type && Move(T &&Obj)
Definition References.h:86