UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LumenUniqueList.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 LumenUniqueList.h:
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "Engine/EngineTypes.h"
12
17template <typename ElementType, typename Allocator>
19{
20 void Add(ElementType Element)
21 {
22 bool bIsAlreadyInSet = false;
23 Set.Add(Element, &bIsAlreadyInSet);
24 if (!bIsAlreadyInSet)
25 {
26 Array.Add(Element);
27 }
28 }
29
32};
33
39{
40public:
42 {
43 if (Index + 1 > IndicesMarkedToUpdate.Num())
44 {
45 const int32 NewSize = Align(Index + 1, 64);
46 IndicesMarkedToUpdate.Add(0, NewSize - IndicesMarkedToUpdate.Num());
47 }
48
49 // Make sure we aren't updating same index multiple times
50 if (!IndicesMarkedToUpdate[Index])
51 {
52 Indices.Add(Index);
53 IndicesMarkedToUpdate[Index] = true;
54 }
55 }
56
57 int32 Num() const
58 {
59 return Indices.Num();
60 }
61
62 void Reset()
63 {
64 Indices.Reset();
65 IndicesMarkedToUpdate.Reset();
66 }
67
68 void Empty(int32 Slack)
69 {
70 Indices.Empty(Slack);
71 IndicesMarkedToUpdate.Reset();
72 }
73
74 // Iterate over indices
75 auto begin() const { return Indices.begin(); }
76 auto end() const { return Indices.end(); }
77
78
79private:
80
81 TArray<int32> Indices;
82 TBitArray<> IndicesMarkedToUpdate;
83};
constexpr T Align(T Val, uint64 Alignment)
Definition AlignmentTemplates.h:18
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void Reset(SizeType NewSize=0)
Definition Array.h:2246
UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType end()
Definition Array.h:3391
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType begin()
Definition Array.h:3389
void Empty(SizeType Slack=0)
Definition Array.h:2273
UE_FORCEINLINE_HINT int32 Num() const
Definition BitArray.h:1466
int32 Add(const bool Value)
Definition BitArray.h:615
void Reset()
Definition BitArray.h:817
U16 Index
Definition radfft.cpp:71
Definition SherwoodHashTable.h:395
void Add(KeyType Key, bool *bIsAlreadyInSetPtr=nullptr)
Definition SherwoodHashTable.h:396
Definition LumenUniqueList.h:39
void Add(int32 Index)
Definition LumenUniqueList.h:41
auto begin() const
Definition LumenUniqueList.h:75
int32 Num() const
Definition LumenUniqueList.h:57
void Reset()
Definition LumenUniqueList.h:62
void Empty(int32 Slack)
Definition LumenUniqueList.h:68
auto end() const
Definition LumenUniqueList.h:76
Definition LumenUniqueList.h:19
TArray< ElementType, Allocator > Array
Definition LumenUniqueList.h:30
Experimental::TSherwoodSet< ElementType > Set
Definition LumenUniqueList.h:31
void Add(ElementType Element)
Definition LumenUniqueList.h:20