5#include "Containers/Map.h"
6#include "Algo/BinarySearch.h"
21 template <
typename OtherKeyType,
typename OtherValueType,
typename OtherArrayAllocator,
typename OtherSortPredicate>
39 template<
typename OtherArrayAllocator>
46 template<
typename OtherArrayAllocator>
58 this->
Add(Element.Key, Element.Value);
81 template<
typename OtherArrayAllocator>
89 template<
typename OtherArrayAllocator>
102 this->
Add(Element.Key, Element.Value);
110 return Pairs ==
Other.Pairs;
116 return Pairs !=
Other.Pairs;
215 template <
typename InitKeyType = KeyType,
typename InitValueType = ValueType>
222 return DataPtr->Value;
231 template <
typename InitKeyType = KeyType>
238 return DataPtr->Value;
271 if(PairIt->Value ==
Value)
287 int32 FoundIndex = FindIndex(Key);
291 return &Pairs[FoundIndex].Value;
455 int32 FoundIndex = FindIndex(Key);
475 int32 FoundIndex = FindIndex(Key);
488 template<
typename OtherArrayAllocator,
typename OtherSortPredicate>
505 template<
typename OtherArrayAllocator,
typename OtherSortPredicate>
511 this->
Add(Pair.Key, Pair.Value);
534 return Pairs.
Num() - 1;
550 return Pairs[
Id.AsInteger()];
556 return Pairs[
Id.AsInteger()];
563 template <
typename ArgType>
581 template <
typename InitKeyType>
585 check(InsertIndex >= 0 && InsertIndex <= Pairs.
Num());
592 DataPtr = Pairs.
GetData() + InsertIndex;
599 DataPtr = Pairs.
GetData() + InsertIndex;
615 template<
bool bConst>
619 typedef std::conditional_t<bConst,typename ElementArrayType::TConstIterator,typename ElementArrayType::TIterator> PairItType;
621 typedef std::conditional_t<bConst,const TSortedMap,TSortedMap> MapType;
622 typedef std::conditional_t<bConst,const KeyType,KeyType> ItKeyType;
623 typedef std::conditional_t<bConst,const ValueType,ValueType> ItValueType;
624 typedef std::conditional_t<bConst,const typename ElementArrayType::ElementType, typename ElementArrayType::ElementType> PairType;
647 return PairIt ==
Rhs.PairIt;
651 return PairIt !=
Rhs.PairIt;
660 return PairIt->Value;
682 template<
bool bConst>
683 class TBaseReverseIterator
687 typedef std::conditional_t<bConst, const TSortedMap, TSortedMap> MapType;
688 typedef std::conditional_t<bConst, const KeyType, KeyType> ItKeyType;
689 typedef std::conditional_t<bConst, const ValueType, ValueType> ItValueType;
693 typedef std::conditional_t<bConst, const typename ElementArrayType::ElementType, typename ElementArrayType::ElementType> PairType;
702 inline TBaseReverseIterator& operator++()
704 checkf(
Index !=
static_cast<SizeType
>(-1),
TEXT(
"Incrementing an invalid iterator is illegal"));
712 return Index !=
static_cast<SizeType
>(-1);
753 ElementArrayType Pairs;
821 using Super = TBaseIterator<true>;
831 Super::PairIt += NewIndex;
835 Super::PairIt.SetToEnd();
841 Super::PairIt.SetToEnd();
849 using Super = TBaseIterator<false>;
859 Super::PairIt += NewIndex;
863 Super::PairIt.SetToEnd();
869 Super::PairIt.SetToEnd();
876 Super::PairIt.RemoveCurrent();
877 Super::PairIt.SetToEnd();
926 template <
typename KeyType,
typename ValueType,
typename ArrayAllocator,
typename SortPredicate>
940template <
typename KeyType,
typename ValueType,
typename ArrayAllocator,
typename SortPredicate>
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FORCEINLINE constexpr void DestructItems(ElementType *Element, SizeType Count)
Definition MemoryOps.h:81
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, TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > &Map)
Definition SortedMap.h:941
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
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
Definition SetUtilities.h:95
static UE_FORCEINLINE_HINT FSetElementId FromInteger(int32 Integer)
Definition SetUtilities.h:121
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
typename InAllocatorType::SizeType SizeType
Definition Array.h:675
UE_REWRITE bool IsEmpty() const
Definition Array.h:1133
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
void Empty(SizeType Slack=0)
Definition Array.h:2273
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition SortedMap.h:781
UE_FORCEINLINE_HINT TConstIterator(const typename TBaseIterator< true >::PairItType &InPairIt)
Definition SortedMap.h:788
UE_FORCEINLINE_HINT TConstIterator(const TSortedMap &InMap)
Definition SortedMap.h:783
Definition SortedMap.h:820
TConstKeyIterator(const TSortedMap &InMap, KeyInitType InKey)
Definition SortedMap.h:824
TConstKeyIterator & operator++()
Definition SortedMap.h:839
Definition SortedMap.h:808
UE_FORCEINLINE_HINT TConstReverseIterator(const TSortedMap &InMap)
Definition SortedMap.h:810
Definition SortedMap.h:759
UE_FORCEINLINE_HINT void RemoveCurrent()
Definition SortedMap.h:773
UE_FORCEINLINE_HINT TIterator(const typename TBaseIterator< false >::PairItType &InPairIt)
Definition SortedMap.h:767
UE_FORCEINLINE_HINT TIterator(TSortedMap &InMap)
Definition SortedMap.h:762
Definition SortedMap.h:848
TKeyIterator & operator++()
Definition SortedMap.h:867
TKeyIterator(TSortedMap &InMap, KeyInitType InKey)
Definition SortedMap.h:852
void RemoveCurrent()
Definition SortedMap.h:874
Definition SortedMap.h:796
UE_FORCEINLINE_HINT TReverseIterator(TSortedMap &InMap)
Definition SortedMap.h:798
Definition SortedMap.h:20
void Dump(FOutputDevice &Ar)
Definition SortedMap.h:441
TSortedMap & operator=(TSortedMap &&)=default
UE_FORCEINLINE_HINT ValueType & Add(const KeyType &InKey, ValueType &&InValue)
Definition SortedMap.h:195
UE_FORCEINLINE_HINT void Shrink()
Definition SortedMap.h:136
UE_FORCEINLINE_HINT ValueType & Add(const KeyType &InKey, const ValueType &InValue)
Definition SortedMap.h:194
ValueType * Find(KeyConstPointerType Key)
Definition SortedMap.h:285
UE_FORCEINLINE_HINT bool IsValidId(FSetElementId Id) const
Definition SortedMap.h:542
ElementArrayType::RangedForConstIteratorType RangedForConstIteratorType
Definition SortedMap.h:907
UE_FORCEINLINE_HINT int32 Max() const
Definition SortedMap.h:165
InValueType ValueType
Definition SortedMap.h:26
UE_FORCEINLINE_HINT RangedForIteratorType end()
Definition SortedMap.h:916
UE_FORCEINLINE_HINT const ValueType & operator[](KeyConstPointerType Key) const
Definition SortedMap.h:519
UE_FORCEINLINE_HINT ValueType & FindOrAdd(KeyType &&Key)
Definition SortedMap.h:310
ValueType FindRef(KeyConstPointerType Key, ValueType DefaultValue) const
Definition SortedMap.h:355
UE_FORCEINLINE_HINT ValueType & operator[](KeyConstPointerType Key)
Definition SortedMap.h:515
TSortedMap(const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other)
Definition SortedMap.h:47
void GenerateValueArray(TArray< ValueType, Allocator > &OutArray) const
Definition SortedMap.h:427
UE_FORCEINLINE_HINT ValueType & Add(KeyType &&InKey, const ValueType &InValue)
Definition SortedMap.h:196
UE_FORCEINLINE_HINT const ElementType & Get(FSetElementId Id) const
Definition SortedMap.h:554
static constexpr bool bHasIntrusiveUnsetOptionalState
Definition SortedMap.h:65
UE_FORCEINLINE_HINT void CountBytes(FArchive &Ar) const
Definition SortedMap.h:182
TSortedMap(TSortedMap &&)=default
UE_FORCEINLINE_HINT ValueType & Add(KeyType &&InKey)
Definition SortedMap.h:206
ElementArrayType::RangedForIteratorType RangedForIteratorType
Definition SortedMap.h:906
UE_DEPRECATED(5.7 until 5.9, "GetMaxIndex() should be replaced with Num() - 1.") UE_FORCEINLINE_HINT int32 GetMaxIndex() const
Definition SortedMap.h:527
UE_FORCEINLINE_HINT ValueType & Add(const KeyType &InKey)
Definition SortedMap.h:205
TPair< KeyType, ValueType > ElementType
Definition SortedMap.h:30
UE_FORCEINLINE_HINT RangedForConstIteratorType end() const
Definition SortedMap.h:917
UE_FORCEINLINE_HINT SIZE_T GetAllocatedSize() const
Definition SortedMap.h:176
InKeyType KeyType
Definition SortedMap.h:25
TTypeTraits< KeyType >::ConstPointerType KeyConstPointerType
Definition SortedMap.h:27
ValueType FindAndRemoveChecked(KeyConstPointerType Key)
Definition SortedMap.h:473
UE_FORCEINLINE_HINT bool operator==(const TSortedMap &Other) const
Definition SortedMap.h:108
UE_FORCEINLINE_HINT void Empty(int32 ExpectedNumElements=0)
Definition SortedMap.h:124
ValueType & Emplace(InitKeyType &&InKey)
Definition SortedMap.h:232
UE_FORCEINLINE_HINT ValueType & Add(KeyType &&InKey, ValueType &&InValue)
Definition SortedMap.h:197
UE_FORCEINLINE_HINT RangedForIteratorType begin()
Definition SortedMap.h:914
TSortedMap & operator=(TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other)
Definition SortedMap.h:82
UE_FORCEINLINE_HINT TIterator CreateIterator()
Definition SortedMap.h:882
void GenerateKeyArray(TArray< KeyType, Allocator > &OutArray) const
Definition SortedMap.h:415
const KeyType * FindKey(ValueInitType Value) const
Definition SortedMap.h:267
const ElementType * FindArbitraryElement() const
Definition SortedMap.h:376
TSortedMap(TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &&Other)
Definition SortedMap.h:40
bool operator==(FIntrusiveUnsetOptionalState Tag) const
Definition SortedMap.h:72
ValueType & Emplace(InitKeyType &&InKey, InitValueType &&InValue)
Definition SortedMap.h:216
UE_FORCEINLINE_HINT TConstIterator CreateConstIterator() const
Definition SortedMap.h:888
UE_FORCEINLINE_HINT RangedForConstIteratorType begin() const
Definition SortedMap.h:915
UE_FORCEINLINE_HINT bool operator!=(const TSortedMap &Other) const
Definition SortedMap.h:114
TSortedMap(FIntrusiveUnsetOptionalState Tag)
Definition SortedMap.h:68
TSortedMap & operator=(const TSortedMap &)=default
TTypeTraits< KeyType >::ConstInitType KeyInitType
Definition SortedMap.h:28
bool IsEmpty() const
Definition SortedMap.h:153
ValueType FindRef(KeyConstPointerType Key) const
Definition SortedMap.h:338
UE_FORCEINLINE_HINT const ValueType * Find(KeyConstPointerType Key) const
Definition SortedMap.h:297
bool RemoveAndCopyValue(KeyInitType Key, ValueType &OutRemovedValue)
Definition SortedMap.h:453
ValueType & FindChecked(KeyConstPointerType Key)
Definition SortedMap.h:318
UE_FORCEINLINE_HINT TConstKeyIterator CreateConstKeyIterator(KeyInitType InKey) const
Definition SortedMap.h:900
TSortedMap(const TSortedMap &)=default
TSortedMap & operator=(std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
Definition SortedMap.h:97
TTypeTraits< ValueType >::ConstInitType ValueInitType
Definition SortedMap.h:29
int32 GetKeys(TArray< KeyType, Allocator > &OutKeys) const
Definition SortedMap.h:402
void Append(TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &&OtherMap)
Definition SortedMap.h:489
friend class TSortedMap
Definition SortedMap.h:22
UE_FORCEINLINE_HINT void Reserve(int32 Number)
Definition SortedMap.h:142
void Append(const TSortedMap< KeyType, ValueType, OtherArrayAllocator, OtherSortPredicate > &OtherMap)
Definition SortedMap.h:506
UE_FORCEINLINE_HINT int32 Num() const
Definition SortedMap.h:159
TSortedMap(std::initializer_list< TPairInitializer< const KeyType &, const ValueType & > > InitList)
Definition SortedMap.h:53
UE_FORCEINLINE_HINT void Reset()
Definition SortedMap.h:130
ElementType * FindArbitraryElement()
Definition SortedMap.h:370
TSortedMap & operator=(const TSortedMap< KeyType, ValueType, OtherArrayAllocator, SortPredicate > &Other)
Definition SortedMap.h:90
const ValueType & FindChecked(KeyConstPointerType Key) const
Definition SortedMap.h:325
UE_FORCEINLINE_HINT ValueType & FindOrAdd(const KeyType &Key)
Definition SortedMap.h:309
int32 Remove(KeyConstPointerType InKey)
Definition SortedMap.h:247
UE_FORCEINLINE_HINT TKeyIterator CreateKeyIterator(KeyInitType InKey)
Definition SortedMap.h:894
bool Contains(KeyConstPointerType Key) const
Definition SortedMap.h:387
UE_FORCEINLINE_HINT ElementType & Get(FSetElementId Id)
Definition SortedMap.h:548
UE_REWRITE void SortBy(RangeType &&Range, ProjectionType Proj)
Definition Sort.h:40
UE_REWRITE auto LowerBoundBy(const RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
Definition BinarySearch.h:113
auto BinarySearchBy(const RangeType &Range, const ValueType &Value, ProjectionType Projection, SortPredicateType SortPredicate) -> decltype(GetNum(Range))
Definition BinarySearch.h:203
GeometryCollection::Facades::FMuscleActivationData Data
Definition MuscleActivationConstraints.h:15
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
U16 Index
Definition radfft.cpp:71
Definition IntrusiveUnsetOptionalState.h:71
Definition SortedMap.h:925
static void Serialize(FArchive &Ar, TSortedMap< KeyType, ValueType, ArrayAllocator, SortPredicate > &Map)
Definition SortedMap.h:927
TCallTraits< T >::ParamType ConstInitType
Definition UnrealTypeTraits.h:336
TCallTraits< T >::ConstPointerType ConstPointerType
Definition UnrealTypeTraits.h:337