UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType > Class Template Reference

#include <SharedPointerArray.h>

Classes

class  Iterator
 

Public Types

using ElementType = InElementType
 
using ElementAllocatorType = InElementAllocatorType
 
using PointerType = TSPtrG< ElementType, AllowNull, typename InElementAllocatorType::RawAllocatorType, RawAllocatorArgsType... >
 
using PointerStorageType = TArrayG< ElementType *, InElementAllocatorType, RawAllocatorArgsType... >
 

Public Member Functions

ULANG_FORCEINLINE TSPtrArrayG (RawAllocatorArgsType &&... RawAllocatorArgs)
 
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG (std::initializer_list< TSPtrG< OtherElementType, OtherAllowNull, typename InElementAllocatorType::RawAllocatorType, RawAllocatorArgsType... > > InitList, RawAllocatorArgsType &&... RawAllocatorArgs)
 
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG (const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &Other)
 
ULANG_FORCEINLINE TSPtrArrayG (const TSPtrArrayG &Other)
 
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG (const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &Other, int32_t ExtraSlack)
 
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
TSPtrArrayGoperator= (const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &Other)
 
TSPtrArrayGoperator= (const TSPtrArrayG &Other)
 
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG (TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&Other)
 
ULANG_FORCEINLINE TSPtrArrayG (TSPtrArrayG &&Other)
 
template<class OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
 TSPtrArrayG (TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&Other, int32_t ExtraSlack)
 
template<class OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
TSPtrArrayGoperator= (TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&Other)
 
TSPtrArrayGoperator= (TSPtrArrayG &&Other)
 
 ~TSPtrArrayG ()
 
ULANG_FORCEINLINE int32_t GetSlack () const
 
ULANG_FORCEINLINE bool IsValidIndex (int32_t Index) const
 
ULANG_FORCEINLINE int32_t Num () const
 
ULANG_FORCEINLINE int32_t Max () const
 
ULANG_FORCEINLINE bool IsEmpty () const
 
ULANG_FORCEINLINE bool IsFilled () const
 
ULANG_FORCEINLINE PointerType operator[] (int32_t Index) const
 
ULANG_FORCEINLINE PointerType Pop (bool bAllowShrinking=true)
 
ULANG_FORCEINLINE void Push (const PointerType &Item)
 
ULANG_FORCEINLINE PointerType First () const
 
ULANG_FORCEINLINE PointerType Top () const
 
ULANG_FORCEINLINE PointerType Last (int32_t IndexFromTheEnd=0) const
 
ULANG_FORCEINLINE void Shrink ()
 
ULANG_FORCEINLINE bool Find (const ElementType *Item, int32_t &Index) const
 
ULANG_FORCEINLINE bool Find (const PointerType &Item, int32_t &Index) const
 
ULANG_FORCEINLINE int32_t Find (const ElementType *Item) const
 
ULANG_FORCEINLINE int32_t Find (const PointerType &Item) const
 
ULANG_FORCEINLINE bool FindLast (const PointerType &Item, int32_t &Index) const
 
ULANG_FORCEINLINE int32_t FindLast (const PointerType &Item) const
 
template<typename Predicate >
ULANG_FORCEINLINE int32_t FindLastByPredicate (Predicate Pred, int32_t Count) const
 
template<typename Predicate >
ULANG_FORCEINLINE int32_t FindLastByPredicate (Predicate Pred) const
 
template<typename KeyType >
int32_t IndexOfByKey (const KeyType &Key) const
 
template<typename Predicate >
int32_t IndexOfByPredicate (Predicate Pred) const
 
template<typename KeyType >
ULANG_FORCEINLINE TOptional< PointerTypeFindByKey (const KeyType &Key) const
 
template<typename Predicate >
ULANG_FORCEINLINE TOptional< PointerTypeFindByPredicate (Predicate Pred) const
 
bool Contains (const PointerType &Pointer) const
 
template<typename ComparisonType >
bool ContainsByKey (const ComparisonType &Key) const
 
template<typename Predicate >
ULANG_FORCEINLINE bool ContainsByPredicate (Predicate Pred) const
 
void InsertZeroed (int32_t Index, int32_t Count=1)
 
int32_t Insert (const TSPtrArrayG &Items, const int32_t InIndex)
 
int32_t Insert (TSPtrArrayG &&Items, const int32_t InIndex)
 
int32_t Insert (const PointerType &Item, int32_t Index)
 
ULANG_FORCEINLINE PointerType RemoveAt (int32_t Index)
 
template<typename CountType >
ULANG_FORCEINLINE void RemoveAt (int32_t Index, CountType Count, bool bAllowShrinking=true)
 
ULANG_FORCEINLINE void RemoveAtSwap (int32_t Index)
 
template<typename CountType >
ULANG_FORCEINLINE void RemoveAtSwap (int32_t Index, CountType Count, bool bAllowShrinking=true)
 
int32_t ReplaceAt (const PointerType &Item, int32_t Index)
 
void Reset (int32_t NewSize=0)
 
void Empty (int32_t Slack=0)
 
void SetNumZeroed (int32_t NewNum, bool bAllowShrinking=true)
 
void Append (TSPtrArrayG &Source)
 
void Append (TSPtrArrayG &&Source)
 
TSPtrArrayGoperator+= (TSPtrArrayG &&Other)
 
TSPtrArrayGoperator+= (const TSPtrArrayG &Other)
 
template<typename... CtorArgsType>
ULANG_FORCEINLINE int32_t AddNew (CtorArgsType &&... CtorArgs)
 
template<typename... CtorArgsType>
ULANG_FORCEINLINE void InsertNew (int32_t Index, CtorArgsType &&... CtorArgs)
 
ULANG_FORCEINLINE int32_t Add (const PointerType &Item)
 
int32_t AddZeroed (int32_t Count=1)
 
ULANG_FORCEINLINE int32_t AddUnique (const PointerType &Item)
 
ULANG_FORCEINLINE void Reserve (int32_t Number)
 
int32_t RemoveSingle (const PointerType &Item)
 
int32_t Remove (const PointerType &Item)
 
template<typename Predicate >
int32_t RemoveAll (const Predicate &Pred)
 
template<class Predicate >
void RemoveAllSwap (const Predicate &Pred, bool bAllowShrinking=true)
 
int32_t RemoveSingleSwap (const PointerType &Item, bool bAllowShrinking=true)
 
int32_t RemoveSwap (const PointerType &Item)
 
void Sort ()
 
template<class PredicateType >
void Sort (const PredicateType &Predicate)
 
template<class OtherElementType , bool OtherAllowNull = AllowNull, typename = typename TEnableIf<TPointerIsStaticCastableFromTo<OtherElementType, ElementType>::Value && (AllowNull == OtherAllowNull || OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG< OtherElementType, OtherAllowNull, ElementAllocatorType, RawAllocatorArgsType... > & As ()
 
template<class OtherElementType , bool OtherAllowNull = AllowNull, typename = typename TEnableIf<TPointerIsStaticCastableFromTo<OtherElementType, ElementType>::Value && (AllowNull == OtherAllowNull || OtherAllowNull)>::Type>
ULANG_FORCEINLINE const TSPtrArrayG< OtherElementType, OtherAllowNull, ElementAllocatorType, RawAllocatorArgsType... > & As () const
 
ULANG_FORCEINLINE Iterator begin ()
 
ULANG_FORCEINLINE Iterator begin () const
 
ULANG_FORCEINLINE Iterator end ()
 
ULANG_FORCEINLINE Iterator end () const
 

Protected Types

using DereferenceFuncType = void(*)(ElementType *, const typename ElementAllocatorType::RawAllocatorType &)
 

Protected Member Functions

ULANG_FORCEINLINE void EnableDereference ()
 
ULANG_FORCEINLINE void Dereference (int32_t Index)
 
ULANG_FORCEINLINE void ReferenceRange (int32_t BeginIndex, int32_t EndIndex)
 
ULANG_FORCEINLINE void DereferenceRange (int32_t BeginIndex, int32_t EndIndex)
 
ULANG_FORCEINLINE void ReferenceAll ()
 
ULANG_FORCEINLINE void DereferenceAll ()
 

Protected Attributes

PointerStorageType _PointerStorage
 
DereferenceFuncType _DereferenceFunc
 

Friends

template<typename OtherElementType , bool OtherAllowNull, typename OtherElementAllocatorType , typename... OtherRawAllocatorArgsType>
class TSPtrArrayG
 

Detailed Description

template<typename InElementType, bool AllowNull, typename InElementAllocatorType, typename... RawAllocatorArgsType>
class uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >

Templated dynamic array of shared pointers to elements

Member Typedef Documentation

◆ DereferenceFuncType

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
using uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::DereferenceFuncType = void(*)(ElementType *, const typename ElementAllocatorType::RawAllocatorType &)
protected

Indirection to keep knowledge about ElementType out of default constructor and destructor so that TSPtrArrayG can be forward declared with an incomplete ElementType argument The price we pay is 8 more bytes of memory, indirect function call on each dereference, and that we have to (re-)initialize this function pointer in all methods that can make an empty array non-empty

◆ ElementAllocatorType

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
using uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ElementAllocatorType = InElementAllocatorType

◆ ElementType

◆ PointerStorageType

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
using uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::PointerStorageType = TArrayG<ElementType *, InElementAllocatorType, RawAllocatorArgsType...>

◆ PointerType

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
using uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::PointerType = TSPtrG<ElementType, AllowNull, typename InElementAllocatorType::RawAllocatorType, RawAllocatorArgsType...>

Constructor & Destructor Documentation

◆ TSPtrArrayG() [1/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( RawAllocatorArgsType &&...  RawAllocatorArgs)
inline

Constructor

◆ TSPtrArrayG() [2/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( std::initializer_list< TSPtrG< OtherElementType, OtherAllowNull, typename InElementAllocatorType::RawAllocatorType, RawAllocatorArgsType... > >  InitList,
RawAllocatorArgsType &&...  RawAllocatorArgs 
)
inline

Initializer list constructor

◆ TSPtrArrayG() [3/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &  Other)
inline

Implicitly casting copy-ish constructor.

Parameters
OtherThe source array to copy.

◆ TSPtrArrayG() [4/8]

Copy constructor.

Parameters
OtherThe source array to copy.

◆ TSPtrArrayG() [5/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &  Other,
int32_t  ExtraSlack 
)
inline

Implicitly casting copy-ish constructor with extra slack.

Parameters
OtherThe source array to copy.
ExtraSlackTells how much extra memory should be preallocated at the end of the array in the number of elements.

◆ TSPtrArrayG() [6/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
ULANG_FORCEINLINE uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&  Other)
inline

Implicitly casting move-ish constructor.

Parameters
OtherArray to move from.

◆ TSPtrArrayG() [7/8]

Move constructor.

Parameters
OtherArray to move from.

◆ TSPtrArrayG() [8/8]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::TSPtrArrayG ( TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&  Other,
int32_t  ExtraSlack 
)
inline

Implicitly casting move-ish constructor with extra slack.

Parameters
OtherArray to move from.
ExtraSlackTells how much extra pointer memory should be preallocated at the end of the array in the number of elements.

◆ ~TSPtrArrayG()

Destructor.

Member Function Documentation

◆ Add()

Adds a new item to the end of the array, possibly reallocating the whole array to fit.

Move semantics version.

Parameters
ItemThe item to add
Returns
Index to the new item
See also
AddDefaulted, AddUnique, AddZeroed, Append, Insert

◆ AddNew()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename... CtorArgsType>
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::AddNew ( CtorArgsType &&...  CtorArgs)
inline

Constructs a new item at the end of the array, possibly reallocating the whole array to fit.

Parameters
ArgsThe arguments to forward to the constructor of the new item.
Returns
Index to the new item

◆ AddUnique()

Adds unique element to array if it doesn't exist.

Parameters
ArgsItem to add.
Returns
Index of the element in the array.
See also
Add, AddDefaulted, AddZeroed, Append, Insert

◆ AddZeroed()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::AddZeroed ( int32_t  Count = 1)
inline

Adds new items to the end of the array, possibly reallocating the whole array to fit. The new items will be zeroed.

Caution, AddZeroed() will create elements without calling the constructor and this is not appropriate for element types that require a constructor to function properly.

Parameters
CountThe number of new items to add.
Returns
Index to the first of the new items.
See also
Add, AddDefaulted, AddUnique, Append, Insert

◆ Append() [1/2]

Appends the specified array to this array.

Parameters
SourceThe array to append.
See also
Add, Insert

◆ Append() [2/2]

Appends the specified array to this array.

Allocator changing version.

Parameters
SourceThe array to append.
See also
Add, Insert

◆ As() [1/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class OtherElementType , bool OtherAllowNull = AllowNull, typename = typename TEnableIf<TPointerIsStaticCastableFromTo<OtherElementType, ElementType>::Value && (AllowNull == OtherAllowNull || OtherAllowNull)>::Type>
ULANG_FORCEINLINE TSPtrArrayG< OtherElementType, OtherAllowNull, ElementAllocatorType, RawAllocatorArgsType... > & uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::As ( )
inline

Casts TSPtrArray<T>& -> TSPtrArray& if T is castable to U.

◆ As() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class OtherElementType , bool OtherAllowNull = AllowNull, typename = typename TEnableIf<TPointerIsStaticCastableFromTo<OtherElementType, ElementType>::Value && (AllowNull == OtherAllowNull || OtherAllowNull)>::Type>
ULANG_FORCEINLINE const TSPtrArrayG< OtherElementType, OtherAllowNull, ElementAllocatorType, RawAllocatorArgsType... > & uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::As ( ) const
inline

◆ begin() [1/2]

◆ begin() [2/2]

◆ Contains()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Contains ( const PointerType Pointer) const
inline

Checks if this array contains the exact pointer.

Returns
True if found. False otherwise.
See also
ContainsByPredicate, FilterByPredicate, FindByPredicate

◆ ContainsByKey()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ContainsByKey ( const ComparisonType Key) const
inline

Checks if this array contains the element.

Returns
True if found. False otherwise.
See also
ContainsByPredicate, FilterByPredicate, FindByPredicate

◆ ContainsByPredicate()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
ULANG_FORCEINLINE bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ContainsByPredicate ( Predicate  Pred) const
inline

Checks if this array contains element for which the predicate is true.

Parameters
Predicateto use, taking const pointer to array element
Returns
True if found. False otherwise.
See also
Contains, Find

◆ Dereference()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Dereference ( int32_t  Index)
inlineprotected

Decrement reference count on an element

◆ DereferenceAll()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::DereferenceAll ( )
inlineprotected

Decrement reference count on all elements. Delete elements whose reference count reaches zero.

◆ DereferenceRange()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::DereferenceRange ( int32_t  BeginIndex,
int32_t  EndIndex 
)
inlineprotected

Decrement reference count on a range of elements

◆ Empty()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Empty ( int32_t  Slack = 0)
inline

Empties the array. It calls the destructors on held items if needed.

Parameters
Slack(Optional) The expected usage size after empty operation. Default is 0.

◆ EnableDereference()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::EnableDereference ( )
inlineprotected

Set the release function pointer to a valid value

◆ end() [1/2]

◆ end() [2/2]

◆ Find() [1/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Find ( const ElementType Item) const
inline

Finds element within the array (by address comparison).

Parameters
ItemItem to look for.
Returns
Index of the found element. IndexNone otherwise.
See also
FindLast, FindLastByPredicate

◆ Find() [2/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Find ( const ElementType Item,
int32_t Index 
) const
inline

Finds element within the array (by address comparison).

Parameters
ItemItem to look for.
IndexWill contain the found index.
Returns
True if found. False otherwise.
See also
FindLast, FindLastByPredicate

◆ Find() [3/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Find ( const PointerType Item) const
inline

◆ Find() [4/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Find ( const PointerType Item,
int32_t Index 
) const
inline

◆ FindByKey()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename KeyType >
ULANG_FORCEINLINE TOptional< PointerType > uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindByKey ( const KeyType &  Key) const
inline

Finds an item by key (assuming the ElementType overloads operator== for the comparison).

Parameters
KeyThe key to search by.
Returns
Pointer to the first matching element, or nullptr if none is found.
See also
Find

◆ FindByPredicate()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
ULANG_FORCEINLINE TOptional< PointerType > uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindByPredicate ( Predicate  Pred) const
inline

Finds an element which matches a predicate functor.

Parameters
PredThe functor to apply to each element, taking const pointer to array element.
Returns
Pointer to the first element for which the predicate returns true, or nullptr if none is found.
See also
FilterByPredicate, ContainsByPredicate

◆ FindLast() [1/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindLast ( const PointerType Item) const
inline

Finds element within the array starting from the end (by address comparison).

Parameters
ItemItem to look for.
Returns
Index of the found element. IndexNone otherwise.

◆ FindLast() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindLast ( const PointerType Item,
int32_t Index 
) const
inline

Finds element within the array starting from the end (by address comparison).

Parameters
ItemItem to look for.
IndexOutput parameter. Found index.
Returns
True if found. False otherwise.
See also
Find, FindLastByPredicate

◆ FindLastByPredicate() [1/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindLastByPredicate ( Predicate  Pred) const
inline

Searches the array for the last occurrence of an element which matches the specified predicate.

Parameters
PredPredicate taking const pointer to array element and returns true if element matches search criteria, false otherwise.
Returns
Index of the found element. IndexNone otherwise.

◆ FindLastByPredicate() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
ULANG_FORCEINLINE int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::FindLastByPredicate ( Predicate  Pred,
int32_t  Count 
) const
inline

Searches an initial subrange of the array for the last occurrence of an element which matches the specified predicate.

Parameters
PredPredicate taking const pointer to array element and returns true if element matches search criteria, false otherwise.
CountThe number of elements from the front of the array through which to search.
Returns
Index of the found element. IndexNone otherwise.

◆ First()

Returns the first element.

Returns
Reference to the first element.
See also
Last, Pop, Push

◆ GetSlack()

Returns the amount of slack in this array in elements.

See also
Num, Shrink

◆ IndexOfByKey()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename KeyType >
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::IndexOfByKey ( const KeyType &  Key) const
inline

Finds an item by key (assuming the ElementType overloads operator== for the comparison).

Parameters
KeyThe key to search by.
Returns
Index to the first matching element, or IndexNone if none is found.

◆ IndexOfByPredicate()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::IndexOfByPredicate ( Predicate  Pred) const
inline

Finds an item by predicate.

Parameters
PredThe predicate to match, taking const pointer to array element.
Returns
Index to the first matching element, or IndexNone if none is found.

◆ Insert() [1/3]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Insert ( const PointerType Item,
int32_t  Index 
)
inline

Inserts a given element into the array at given location.

Parameters
ItemThe element to insert.
IndexTells where to insert the new elements.
Returns
Location at which the insert was done.
See also
Add, Remove

◆ Insert() [2/3]

Inserts given elements into the array at given location.

Parameters
ItemsArray of elements to insert.
InIndexTells where to insert the new elements.
Returns
Location at which the item was inserted.

◆ Insert() [3/3]

Inserts given elements into the array at given location.

Parameters
ItemsArray of elements to insert.
InIndexTells where to insert the new elements.
Returns
Location at which the item was inserted.

◆ InsertNew()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename... CtorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::InsertNew ( int32_t  Index,
CtorArgsType &&...  CtorArgs 
)
inline

Constructs a new item at a specified index, possibly reallocating the whole array to fit.

Parameters
IndexThe index to add the item at.
ArgsThe arguments to forward to the constructor of the new item.

◆ InsertZeroed()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::InsertZeroed ( int32_t  Index,
int32_t  Count = 1 
)
inline

Inserts a given number of zeroed elements into the array at given location.

Caution, InsertZeroed() will create elements without calling the constructor and this is not appropriate for element types that require a constructor to function properly.

Parameters
IndexTells where to insert the new elements.
CountNumber of elements to add.
See also
Insert, InsertUninitialized, InsertDefaulted

◆ IsEmpty()

Returns true if no elements in array

Returns
true if no elements in array or false if one or more elements.
See also
IsFull, Num

◆ IsFilled()

Returns true if any elements in array

Returns
true if one or more elements in array or false no elements.
See also
IsEmpty, Num

◆ IsValidIndex()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE bool uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::IsValidIndex ( int32_t  Index) const
inline

Tests if index is valid, i.e. greater than or equal to zero, and less than the number of elements in the array.

Parameters
IndexIndex to test.
Returns
True if index is valid. False otherwise.

◆ Last()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE PointerType uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Last ( int32_t  IndexFromTheEnd = 0) const
inline

Returns n-th last element from the array.

Parameters
IndexFromTheEnd(Optional) Index from the end of array (default = 0).
Returns
Reference to n-th last element from the array.

◆ Max()

Returns maximum number of elements in array.

Returns
Maximum number of elements in array.
See also
GetSlack

◆ Num()

Returns number of elements in array.

Returns
Number of elements in array.
See also
GetSlack

◆ operator+=() [1/2]

Appends the specified array to this array. Cannot append to self.

Parameters
OtherThe array to append.

◆ operator+=() [2/2]

Appends the specified array to this array. Cannot append to self.

Move semantics version.

Parameters
OtherThe array to append.

◆ operator=() [1/4]

Copying assignment operator. First deletes all currently contained elements and then copies from other array.

Parameters
OtherThe source array to assign from.

◆ operator=() [2/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
TSPtrArrayG & uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::operator= ( const TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &  Other)
inline

Implicitly casting copying assignment-ish operator. First deletes all currently contained elements and then copies from other array.

Parameters
OtherThe source array to assign from.

◆ operator=() [3/4]

Move assignment operator.

Parameters
OtherArray to assign and move from.

◆ operator=() [4/4]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class OtherElementType , bool OtherAllowNull, typename = typename TEnableIf<std::is_convertible_v<OtherElementType*, InElementType*> && (AllowNull || !OtherAllowNull)>::Type>
TSPtrArrayG & uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::operator= ( TSPtrArrayG< OtherElementType, OtherAllowNull, InElementAllocatorType, RawAllocatorArgsType... > &&  Other)
inline

Implicitly casting move assignment operator.

Parameters
OtherArray to assign and move from.

◆ operator[]()

Array bracket operator. Returns shared pointer to element at given index.

◆ Pop()

Pops element from the array.

Parameters
bAllowShrinkingIf this call allows shrinking of the array during element remove.
Returns
Popped element.

◆ Push()

Pushes element into the array.

Parameters
ItemItem to push.

◆ ReferenceAll()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ReferenceAll ( )
inlineprotected

Increment reference count on all elements

◆ ReferenceRange()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ReferenceRange ( int32_t  BeginIndex,
int32_t  EndIndex 
)
inlineprotected

Increment reference count on a range of elements

◆ Remove()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Remove ( const PointerType Item)
inline

Removes as many instances of Item as there are in the array, maintaining order but not indices.

Parameters
ItemItem to remove from array.
Returns
Number of removed elements.
See also
Add, Insert, RemoveAll, RemoveAllSwap, RemoveSingle, RemoveSwap

◆ RemoveAll()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename Predicate >
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveAll ( const Predicate &  Pred)
inline

Remove all instances that match the predicate, maintaining order but not indices Optimized to work with runs of matches/non-matches

Parameters
PredPredicate, taking const pointer to array element
Returns
Number of removed elements.
See also
Add, Insert, RemoveAllSwap, RemoveSingle, RemoveSwap

◆ RemoveAllSwap()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class Predicate >
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveAllSwap ( const Predicate &  Pred,
bool  bAllowShrinking = true 
)
inline

Remove all instances that match the predicate

Parameters
PredPredicate, taking const pointer to array element
See also
Remove, RemoveSingle, RemoveSingleSwap, RemoveSwap

◆ RemoveAt() [1/2]

Removes an element (or elements) at given location optionally shrinking the array.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.
Returns
The element removed from the array.

◆ RemoveAt() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename CountType >
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveAt ( int32_t  Index,
CountType  Count,
bool  bAllowShrinking = true 
)
inline

Removes an element (or elements) at given location optionally shrinking the array.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

◆ RemoveAtSwap() [1/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveAtSwap ( int32_t  Index)
inline

Removes an element (or elements) at given location optionally shrinking the array.

This version is much more efficient than RemoveAt (O(Count) instead of O(ArrayNum)), but does not preserve the order.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

◆ RemoveAtSwap() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename CountType >
ULANG_FORCEINLINE void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveAtSwap ( int32_t  Index,
CountType  Count,
bool  bAllowShrinking = true 
)
inline

Removes an element (or elements) at given location optionally shrinking the array.

This version is much more efficient than RemoveAt (O(Count) instead of O(ArrayNum)), but does not preserve the order.

Parameters
IndexLocation in array of the element to remove.
Count(Optional) Number of elements to remove. Default is 1.
bAllowShrinking(Optional) Tells if this call can shrink array if suitable after remove. Default is true.

◆ RemoveSingle()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveSingle ( const PointerType Item)
inline

Removes the first occurrence of the specified item in the array, maintaining order but not indices.

Parameters
ItemThe item to remove.
Returns
The number of items removed. For RemoveSingleItem, this is always either 0 or 1.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap

◆ RemoveSingleSwap()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveSingleSwap ( const PointerType Item,
bool  bAllowShrinking = true 
)
inline

Removes the first occurrence of the specified item in the array. This version is much more efficient O(Count) instead of O(ArrayNum), but does not preserve the order

Parameters
ItemThe item to remove
Returns
The number of items removed. For RemoveSingleItem, this is always either 0 or 1.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap, RemoveSwap

◆ RemoveSwap()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::RemoveSwap ( const PointerType Item)
inline

Removes item from the array.

This version is much more efficient, because it uses RemoveAtSwap internally which is O(Count) instead of RemoveAt which is O(ArrayNum), but does not preserve the order.

Returns
Number of elements removed.
See also
Add, Insert, Remove, RemoveAll, RemoveAllSwap

◆ ReplaceAt()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
int32_t uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::ReplaceAt ( const PointerType Item,
int32_t  Index 
)
inline

Replaces a given element at a given location.

Parameters
ItemThe element to insert.
IndexTells where to insert the new element.
Returns
Location at which the replacement was done.
See also
Add, Remove

◆ Reserve()

Reserves memory such that the array can contain at least Number elements.

Parameters
NumberThe number of elements that the array should be able to contain after allocation.
See also
Shrink

◆ Reset()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Reset ( int32_t  NewSize = 0)
inline

Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array. It calls the destructors on held items if needed and then zeros the ArrayNum.

Parameters
NewSizeThe expected usage size after calling this function.

◆ SetNumZeroed()

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::SetNumZeroed ( int32_t  NewNum,
bool  bAllowShrinking = true 
)
inline

Resizes array to given number of elements. New elements will be zeroed.

Parameters
NewNumNew size of the array.

◆ Shrink()

Shrinks the array's used pointer memory to smallest possible to store elements currently in it.

See also
Slack

◆ Sort() [1/2]

Sorts the array assuming < operator is defined for ElementType.

◆ Sort() [2/2]

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<class PredicateType >
void uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::Sort ( const PredicateType Predicate)
inline

Sorts the array using user define predicate class.

Parameters
PredicatePredicate instance or lambda, taking const pointer to array element

◆ Top()

Returns the top element, i.e. the last one.

Returns
Reference to the top element.
See also
Pop, Push

Friends And Related Symbol Documentation

◆ TSPtrArrayG

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
template<typename OtherElementType , bool OtherAllowNull, typename OtherElementAllocatorType , typename... OtherRawAllocatorArgsType>
friend class TSPtrArrayG
friend

Member Data Documentation

◆ _DereferenceFunc

template<typename InElementType , bool AllowNull, typename InElementAllocatorType , typename... RawAllocatorArgsType>
DereferenceFuncType uLang::TSPtrArrayG< InElementType, AllowNull, InElementAllocatorType, RawAllocatorArgsType >::_DereferenceFunc
protected

◆ _PointerStorage


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