5#include "Algo/BinarySearch.h"
12template <
typename ElementType,
typename ArrayAllocator,
typename SortPredicate>
26 template <
typename OtherElementType,
typename OtherArrayAllocator,
typename OtherSortPredicate>
42 template<
typename OtherArrayAllocator>
49 template<
typename OtherArrayAllocator>
51 : Elements(
Other.Elements)
74 return Elements ==
Tag;
81 template<
typename OtherArrayAllocator>
89 template<
typename OtherArrayAllocator>
92 Elements =
Other.Elements;
107 return Elements ==
Other.Elements;
113 return Elements !=
Other.Elements;
158 return Elements.
Num();
164 return Elements.
Max();
170 return Elements.
Num();
213 template <
typename InitArgType = ElementType>
249 int32 FoundIndex = FindIndex(Key);
252 return &Elements[FoundIndex];
287 return Elements.
IsEmpty() ? nullptr : &Elements.
Last();
324 Ar.
Logf(
TEXT(
"TSortedSet: %i elements"), Elements.
Num());
328 template <
bool bMove>
329 void AppendImpl(std::conditional_t<bMove, ElementType, const ElementType>* Ptr,
int32 Count)
349 int32 InsertIndex = 0;
444 template <
typename OtherArrayAllocator,
typename OtherSortPredicate>
450 template <
typename OtherArrayAllocator,
typename OtherSortPredicate>
455 template <
typename OtherArrayAllocator>
465 template <
typename OtherArrayAllocator>
483 return Elements[
Id.AsInteger()];
502 template <
typename InitArgType>
521 return *(Elements.
GetData() + InsertIndex);
531 template <
typename InitArgType>
543 DataPtr = Elements.
GetData() + InsertIndex;
550 DataPtr = Elements.
GetData() + InsertIndex;
562 template<
bool bConst>
566 using ArrayIteratorType = std::conditional_t<bConst, typename ElementArrayType::TConstIterator, typename ElementArrayType::TIterator>;
567 using ItElementType = std::conditional_t<bConst, const ElementType, ElementType>;
590 return ArrayIt ==
Rhs.ArrayIt;
594 return !(*
this ==
Rhs);
612 ArrayIteratorType ArrayIt;
616 ElementArrayType Elements;
664 return Elements.begin();
668 return Elements.begin();
672 return Elements.end();
676 return Elements.end();
682template <
typename ElementType,
typename ArrayAllocator,
typename SortPredicate>
constexpr auto MakeArrayView(OtherRangeType &&Other)
Definition ArrayView.h:873
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FORCEINLINE constexpr void DestructItem(ElementType *Element)
Definition MemoryOps.h:56
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define DECLARE_TEMPLATE_INTRINSIC_TYPE_LAYOUT(TemplatePrefix, T)
Definition MemoryLayout.h:661
bool SortPredicate(const FCompileOnTheFlyData &A, const FCompileOnTheFlyData &B)
Definition MovieSceneCompiledDataManager.cpp:364
const bool
Definition NetworkReplayStreaming.h:178
FArchive & operator<<(FArchive &Ar, TSortedSet< ElementType, ArrayAllocator, SortPredicate > &Set)
Definition SortedSet.h:683
float Val(const FString &Value)
Definition UnrealMath.cpp:3163
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition Archive.h:1208
UE_FORCEINLINE_HINT bool IsLoading() const
Definition Archive.h:236
Definition OutputDevice.h:133
void Logf(const FmtType &Fmt)
Definition OutputDevice.h:234
Definition SetUtilities.h:95
static UE_FORCEINLINE_HINT FSetElementId FromInteger(int32 Integer)
Definition SetUtilities.h:121
Definition ArrayView.h:139
UE_FORCEINLINE_HINT constexpr ElementType * GetData() const
Definition ArrayView.h:295
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT ElementType & Last(SizeType IndexFromTheEnd=0) UE_LIFETIMEBOUND
Definition Array.h:1263
UE_NODEBUG UE_FORCEINLINE_HINT void InsertUninitialized(SizeType Index)
Definition Array.h:1782
void RemoveAt(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2083
void Reset(SizeType NewSize=0)
Definition Array.h:2246
UE_NODEBUG UE_FORCEINLINE_HINT ElementType * GetData() UE_LIFETIMEBOUND
Definition Array.h:1027
UE_REWRITE SizeType Max() const
Definition Array.h:1161
UE_REWRITE bool IsEmpty() const
Definition Array.h:1133
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
UE_NODEBUG UE_FORCEINLINE_HINT bool IsValidIndex(SizeType Index) const
Definition Array.h:1122
UE_NODEBUG void CountBytes(FArchive &Ar) const
Definition Array.h:1649
UE_NODEBUG UE_FORCEINLINE_HINT SIZE_T GetAllocatedSize(void) const
Definition Array.h:1059
UE_FORCEINLINE_HINT void Shrink()
Definition Array.h:1278
UE_FORCEINLINE_HINT void EmplaceAt(SizeType Index, ArgsType &&... Args)
Definition Array.h:2665
void Empty(SizeType Slack=0)
Definition Array.h:2273
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition SortedSet.h:637
UE_FORCEINLINE_HINT TConstIterator(const TSortedSet &InSet)
Definition SortedSet.h:639
Definition SortedSet.h:621
UE_FORCEINLINE_HINT void RemoveCurrent()
Definition SortedSet.h:629
UE_FORCEINLINE_HINT TIterator(TSortedSet &InSet)
Definition SortedSet.h:623
Definition SortedSet.h:25
TSortedSet(const TSortedSet &)=default
TSortedSet & operator=(TSortedSet< ElementType, OtherArrayAllocator, SortPredicate > &&Other)
Definition SortedSet.h:82
void Append(TArray< ElementType, OtherArrayAllocator > &&Other)
Definition SortedSet.h:456
TSortedSet & operator=(const TSortedSet< ElementType, OtherArrayAllocator, SortPredicate > &Other)
Definition SortedSet.h:90
UE_FORCEINLINE_HINT auto end() const
Definition SortedSet.h:674
UE_FORCEINLINE_HINT void Empty(int32 ExpectedNumElements=0)
Definition SortedSet.h:121
UE_FORCEINLINE_HINT void Reset()
Definition SortedSet.h:127
UE_FORCEINLINE_HINT bool operator!=(const TSortedSet &Other) const
Definition SortedSet.h:111
typename TTypeTraits< ElementType >::ConstPointerType KeyInitType
Definition SortedSet.h:33
void Append(std::initializer_list< ElementType > Other)
Definition SortedSet.h:466
UE_FORCEINLINE_HINT void Reserve(int32 Number)
Definition SortedSet.h:139
static constexpr bool bHasIntrusiveUnsetOptionalState
Definition SortedSet.h:65
TSortedSet & operator=(std::initializer_list< ElementType > InitList)
Definition SortedSet.h:97
TSortedSet & operator=(TSortedSet &&)=default
UE_FORCEINLINE_HINT auto end()
Definition SortedSet.h:670
UE_FORCEINLINE_HINT TIterator CreateIterator()
Definition SortedSet.h:646
UE_FORCEINLINE_HINT int32 GetMaxIndex() const
Definition SortedSet.h:168
void Append(TArrayView< const ElementType > Other)
Definition SortedSet.h:461
TSortedSet(TSortedSet< InElementType, OtherArrayAllocator, SortPredicate > &&Other)
Definition SortedSet.h:43
UE_FORCEINLINE_HINT const ElementType & Get(FSetElementId Id) const
Definition SortedSet.h:493
UE_FORCEINLINE_HINT TConstIterator CreateConstIterator() const
Definition SortedSet.h:652
TSortedSet(FIntrusiveUnsetOptionalState Tag)
Definition SortedSet.h:68
UE_FORCEINLINE_HINT void Shrink()
Definition SortedSet.h:133
bool operator==(FIntrusiveUnsetOptionalState Tag) const
Definition SortedSet.h:72
ElementType * FindArbitraryElement()
Definition SortedSet.h:283
TArray< ElementType > Array() &&
Definition SortedSet.h:312
UE_FORCEINLINE_HINT void CountBytes(FArchive &Ar) const
Definition SortedSet.h:185
UE_FORCEINLINE_HINT ElementType * Find(KeyInitType Key)
Definition SortedSet.h:247
FSetElementId Emplace(InitArgType &&InInitArg, bool *bIsAlreadyInSetPtr=nullptr)
Definition SortedSet.h:214
void Dump(FOutputDevice &Ar)
Definition SortedSet.h:322
UE_FORCEINLINE_HINT bool Contains(KeyInitType Key) const
Definition SortedSet.h:300
friend class TSortedSet
Definition SortedSet.h:27
UE_FORCEINLINE_HINT auto begin() const
Definition SortedSet.h:666
TSortedSet & operator=(const TSortedSet &)=default
UE_FORCEINLINE_HINT bool operator==(const TSortedSet &Other) const
Definition SortedSet.h:105
UE_FORCEINLINE_HINT bool IsValidId(FSetElementId Id) const
Definition SortedSet.h:476
UE_FORCEINLINE_HINT SIZE_T GetAllocatedSize() const
Definition SortedSet.h:179
UE_FORCEINLINE_HINT ElementType & Get(FSetElementId Id)
Definition SortedSet.h:489
InElementType ElementType
Definition SortedSet.h:32
UE_FORCEINLINE_HINT ElementType & operator[](FSetElementId Id)
Definition SortedSet.h:481
UE_FORCEINLINE_HINT FSetElementId Add(ElementType &&InValue, bool *bIsAlreadyInSetPtr=nullptr)
Definition SortedSet.h:201
TArray< ElementType > Array() const &
Definition SortedSet.h:308
UE_FORCEINLINE_HINT auto begin()
Definition SortedSet.h:662
bool IsEmpty() const
Definition SortedSet.h:150
UE_FORCEINLINE_HINT const ElementType & operator[](FSetElementId Id) const
Definition SortedSet.h:485
UE_FORCEINLINE_HINT ElementType & FindOrAdd(ElementType &&InValue, bool *bIsAlreadyInSetPtr=nullptr)
Definition SortedSet.h:273
UE_FORCEINLINE_HINT int32 Remove(KeyInitType InKey)
Definition SortedSet.h:229
void Append(TSortedSet< ElementType, OtherArrayAllocator, OtherSortPredicate > &&Other)
Definition SortedSet.h:445
UE_FORCEINLINE_HINT ElementType & FindOrAdd(const ElementType &InValue, bool *bIsAlreadyInSetPtr=nullptr)
Definition SortedSet.h:269
const ElementType * FindArbitraryElement() const
Definition SortedSet.h:289
UE_FORCEINLINE_HINT int32 Num() const
Definition SortedSet.h:156
UE_FORCEINLINE_HINT FSetElementId Add(const ElementType &InValue, bool *bIsAlreadyInSetPtr=nullptr)
Definition SortedSet.h:197
void Append(const TSortedSet< ElementType, OtherArrayAllocator, OtherSortPredicate > &Other)
Definition SortedSet.h:451
TSortedSet(const TSortedSet< InElementType, OtherArrayAllocator, SortPredicate > &Other)
Definition SortedSet.h:50
UE_FORCEINLINE_HINT const ElementType * Find(KeyInitType Key) const
Definition SortedSet.h:257
TSortedSet(TSortedSet &&)=default
UE_FORCEINLINE_HINT int32 Max() const
Definition SortedSet.h:162
TSortedSet(std::initializer_list< ElementType > InitList)
Definition SortedSet.h:56
UE_REWRITE void Sort(RangeType &&Range)
Definition Sort.h:16
UE_REWRITE auto LowerBound(const RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
Definition BinarySearch.h:92
auto BinarySearch(const RangeType &Range, const ValueType &Value, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
Definition BinarySearch.h:173
FVector operator*(const FSquareMatrix3 &InMatrix, const FVector &InVector)
Definition ARBlueprintLibrary.cpp:650
bool operator!=(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:506
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
FORCEINLINE UE_STRING_CLASS RhsType && Rhs
Definition String.cpp.inl:718
@ false
Definition radaudio_common.h:23
Definition IntrusiveUnsetOptionalState.h:71
TCallTraits< T >::ConstPointerType ConstPointerType
Definition UnrealTypeTraits.h:337