UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits > Class Template Reference

#include <HashMappedArray.h>

Public Types

using FIDType = TIDType
 
using FElementType = TElementType
 
using FTraits = TTraits
 
using FHashType = uint32
 
using FType = THashMappedArray< FIDType, FElementType, FTraits >
 

Public Member Functions

 THashMappedArray (const int32 InHashSize)
 
void Reset (const int32 InReserveElements)
 
FORCEINLINE bool TryAdd (const FIDType ID, const FElementType &Element)
 
template<typename... ArgsType>
FORCEINLINE bool TryEmplace (const FIDType ID, ArgsType &&... Args)
 
FORCEINLINE void Add (const FIDType ID, const FElementType &Element)
 
template<typename... ArgsType>
FORCEINLINE void Emplace (const FIDType ID, ArgsType &&... Args)
 
void Remove (const FIDType ID)
 
const FElementTypeFind (const FIDType ID) const
 
FElementTypeFind (const FIDType ID)
 
int32 Num () const
 
FElementTypeAt (const int32 ElementIndex)
 
const FElementTypeAt (const int32 ElementIndex) const
 
TArray< FElementTypeExtractElements ()
 

Detailed Description

template<typename TIDType, typename TElementType, typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
class Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >

A HashMap using FHashTable to index an array of elements of type TElementType, whcih should be uniquely identified by an object of type TIDType.

E.g., using FMyDataID = int32; struct FMyData { FMyDataID ID; // Every FMyData will require a unique ID if using the default THashMappedArrayTraits float MyValue; };

const int32 HashTableSize = 128; // Must be power of 2 THashMapedArray<FMyDataID, FMyData> MyDataMap(HashTableSize);

MyDataMap.Add(1, { 1, 1.0 }); // NOTE: ID passed twice. Once for the hash map and once to construct FMyData MyDataMap.Emplace(2, 2, 2.0); // NOTE: ID passed twice. Once for the hash map and once for forwarding args to FMyData

const FMyData* MyData2 = MyDataMap.Find(2); // MyData2->MyValue == 2.0

Member Typedef Documentation

◆ FElementType

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
using Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::FElementType = TElementType

◆ FHashType

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
using Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::FHashType = uint32

◆ FIDType

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
using Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::FIDType = TIDType

◆ FTraits

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
using Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::FTraits = TTraits

◆ FType

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
using Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::FType = THashMappedArray<FIDType, FElementType, FTraits>

Constructor & Destructor Documentation

◆ THashMappedArray()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::THashMappedArray ( const int32  InHashSize)
inline

Member Function Documentation

◆ Add()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
FORCEINLINE void Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Add ( const FIDType  ID,
const FElementType Element 
)
inline

◆ At() [1/2]

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
FElementType & Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::At ( const int32  ElementIndex)
inline

◆ At() [2/2]

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
const FElementType & Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::At ( const int32  ElementIndex) const
inline

◆ Emplace()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
template<typename... ArgsType>
FORCEINLINE void Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Emplace ( const FIDType  ID,
ArgsType &&...  Args 
)
inline

◆ ExtractElements()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
TArray< FElementType > Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::ExtractElements ( )
inline

◆ Find() [1/2]

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
FElementType * Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Find ( const FIDType  ID)
inline

◆ Find() [2/2]

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
const FElementType * Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Find ( const FIDType  ID) const
inline

◆ Num()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
int32 Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Num ( ) const
inline

◆ Remove()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
void Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Remove ( const FIDType  ID)
inline

◆ Reset()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
void Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::Reset ( const int32  InReserveElements)
inline

◆ TryAdd()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
FORCEINLINE bool Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::TryAdd ( const FIDType  ID,
const FElementType Element 
)
inline

◆ TryEmplace()

template<typename TIDType , typename TElementType , typename TTraits = THashMappedArrayTraits<TIDType, TElementType>>
template<typename... ArgsType>
FORCEINLINE bool Chaos::Private::THashMappedArray< TIDType, TElementType, TTraits >::TryEmplace ( const FIDType  ID,
ArgsType &&...  Args 
)
inline

The documentation for this class was generated from the following file: