UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::TSparseListSet< ElementType > Struct Template Reference

#include <SparseListSet.h>

Classes

struct  FListHandle
 

Public Member Functions

 TSparseListSet ()
 
 TSparseListSet (int BlockSizeIn, int BlocksPerChunkIn)
 
bool IsAllocated (int32 ListIndex) const
 
FListHandle AllocateAt (int32 ListIndex)
 
void Insert (int32 ListIndex, ElementType Value)
 
void Insert (FListHandle ListHandle, ElementType Value)
 
void SetValues (int32 ListIndex, const TArray< ElementType > &Values)
 
void SetValues (FListHandle ListHandle, const TArray< ElementType > &Values)
 
bool Remove (int32 ListIndex, ElementType Value)
 
void Clear (int32 ListIndex)
 
int32 GetCount (int32 ListIndex) const
 
bool Contains (int32 ListIndex, ElementType Value) const
 
template<typename FuncType >
void Enumerate (int32 ListIndex, FuncType Func) const
 
template<typename FuncType >
bool EnumerateEarlyOut (int32 ListIndex, FuncType ApplyFunc) const
 

Detailed Description

template<typename ElementType>
struct UE::Geometry::TSparseListSet< ElementType >

TSparseListSet stores a sparse set of indexed variable-size lists. This is useful in cases where many relatively small lists that have a 1-1 correspondence with a bounded index space are needed, eg for per-vertex lists for a mesh, per-cell lists for an octree, etc.

The interface is compatible with FSmallListSet, which may be more effective for very small lists (optimized for ~8 elements), but does not scale very well to larger lists (10s-to-100s).

Internally, TSparseListSet uses a strategy where the small lists are stored in sequences of fixed-size blocks, similar to FDynamicVector, but the block size is configurable. The blocks are allocated from larger "chunks" of blocks (also of configurable size). These parameters can be set on construction to values appropriate for particular use cases.

TSparseListSet can support parallel insertion into the lists. Note however that lists cannot be added (via AllocateAt) while parallel insertion occurs via Insert(Index). To allow for this type of usage, AllocateAt() returns a FListHandle which can then be used with Insert() or SetValues() even while other AllocateAt() calls occur (within a lock).

Constructor & Destructor Documentation

◆ TSparseListSet() [1/2]

template<typename ElementType >
UE::Geometry::TSparseListSet< ElementType >::TSparseListSet ( )
inline

◆ TSparseListSet() [2/2]

template<typename ElementType >
UE::Geometry::TSparseListSet< ElementType >::TSparseListSet ( int  BlockSizeIn,
int  BlocksPerChunkIn 
)
inline
Parameters
BlockSizeIndefines size of small blocks that each list is made up of
BlocksPerChunkIndefines size of large chunks that small blocks are allocated from

Member Function Documentation

◆ AllocateAt()

template<typename ElementType >
FListHandle UE::Geometry::TSparseListSet< ElementType >::AllocateAt ( int32  ListIndex)
inline

Create a list at the given ListIndex

Returns
Handle to allocted list that can be used with Insert and SetValues in multi-threaded contexts

◆ Clear()

template<typename ElementType >
void UE::Geometry::TSparseListSet< ElementType >::Clear ( int32  ListIndex)
inline

Remove all elements from the list at ListIndex

◆ Contains()

template<typename ElementType >
bool UE::Geometry::TSparseListSet< ElementType >::Contains ( int32  ListIndex,
ElementType  Value 
) const

Search for the given Value in list at ListIndex

Returns
true if found

◆ Enumerate()

template<typename ElementType >
template<typename FuncType >
void UE::Geometry::TSparseListSet< ElementType >::Enumerate ( int32  ListIndex,
FuncType  Func 
) const
inline

Call ApplyFunc on each element of the list at ListIndex

◆ EnumerateEarlyOut()

template<typename ElementType >
template<typename FuncType >
bool UE::Geometry::TSparseListSet< ElementType >::EnumerateEarlyOut ( int32  ListIndex,
FuncType  ApplyFunc 
) const
inline

Call ApplyFunc on each element of the list at ListIndex, until ApplyFunc returns false

Returns
true if all elements were processed and ApplyFunc never returned false

◆ GetCount()

template<typename ElementType >
int32 UE::Geometry::TSparseListSet< ElementType >::GetCount ( int32  ListIndex) const
inline
Returns
the size of the list at ListIndex

◆ Insert() [1/2]

template<typename ElementType >
void UE::Geometry::TSparseListSet< ElementType >::Insert ( FListHandle  ListHandle,
ElementType  Value 
)
inline

Insert Value into List identified by ListHandle

◆ Insert() [2/2]

template<typename ElementType >
void UE::Geometry::TSparseListSet< ElementType >::Insert ( int32  ListIndex,
ElementType  Value 
)
inline

Insert Value into List at ListIndex

◆ IsAllocated()

template<typename ElementType >
bool UE::Geometry::TSparseListSet< ElementType >::IsAllocated ( int32  ListIndex) const
inline
Returns
true if a list has been allocated at the given ListIndex

◆ Remove()

template<typename ElementType >
bool UE::Geometry::TSparseListSet< ElementType >::Remove ( int32  ListIndex,
ElementType  Value 
)
inline

remove first occurrence of Value from the list at ListIndex

Returns
false if Value was not in this list

◆ SetValues() [1/2]

template<typename ElementType >
void UE::Geometry::TSparseListSet< ElementType >::SetValues ( FListHandle  ListHandle,
const TArray< ElementType > &  Values 
)
inline

Set the values of the List identified by ListHandle

◆ SetValues() [2/2]

template<typename ElementType >
void UE::Geometry::TSparseListSet< ElementType >::SetValues ( int32  ListIndex,
const TArray< ElementType > &  Values 
)
inline

Set the values of the List at ListIndex


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