UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TSubclassOf< T > Class Template Reference

#include <SubclassOf.h>

+ Inheritance diagram for TSubclassOf< T >:

Public Types

using ElementType = T
 

Public Member Functions

 TSubclassOf ()=default
 
 TSubclassOf (TSubclassOf &&)=default
 
 TSubclassOf (const TSubclassOf &)=default
 
TSubclassOfoperator= (TSubclassOf &&)=default
 
TSubclassOfoperator= (const TSubclassOf &)=default
 
 ~TSubclassOf ()=default
 
UE_FORCEINLINE_HINT TSubclassOf (UClass *From)
 
template<typename U UE_REQUIRES>
UE_FORCEINLINE_HINT TSubclassOf (U &&From)
 
template<typename OtherT >
 TSubclassOf (const TSubclassOf< OtherT > &Other)
 
template<typename OtherT >
TSubclassOfoperator= (const TSubclassOf< OtherT > &Other)
 
TSubclassOfoperator= (UClass *From)
 
template<typename U UE_REQUIRES>
TSubclassOfoperator= (U &&From)
 
UClassoperator* () const
 
UE_FORCEINLINE_HINT UClassGet () const
 
UE_FORCEINLINE_HINT UClassoperator-> () const
 
UE_FORCEINLINE_HINT operator UClass * () const
 
T * GetDefaultObject () const
 
UE_FORCEINLINE_HINT void Serialize (FArchive &Ar)
 
UE_FORCEINLINE_HINT void Serialize (FStructuredArchiveSlot &Slot)
 
TObjectPtr< UClass > & GetGCPtr ()
 

Friends

template<typename U >
class TSubclassOf
 
uint32 GetTypeHash (const TSubclassOf &SubclassOf)
 

Detailed Description

template<typename T>
class TSubclassOf< T >

Template to allow UClass types to be passed around with type safety

Examples
/work/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

Member Typedef Documentation

◆ ElementType

template<typename T >
using TSubclassOf< T >::ElementType = T

Constructor & Destructor Documentation

◆ TSubclassOf() [1/6]

template<typename T >
TSubclassOf< T >::TSubclassOf ( )
default

◆ TSubclassOf() [2/6]

template<typename T >
TSubclassOf< T >::TSubclassOf ( TSubclassOf< T > &&  )
default

◆ TSubclassOf() [3/6]

template<typename T >
TSubclassOf< T >::TSubclassOf ( const TSubclassOf< T > &  )
default

◆ ~TSubclassOf()

template<typename T >
TSubclassOf< T >::~TSubclassOf ( )
default

◆ TSubclassOf() [4/6]

template<typename T >
UE_FORCEINLINE_HINT TSubclassOf< T >::TSubclassOf ( UClass From)
inline

Constructor that takes a UClass*.

◆ TSubclassOf() [5/6]

template<typename T >
template<typename U UE_REQUIRES>
UE_FORCEINLINE_HINT TSubclassOf< T >::TSubclassOf ( U &&  From)
inline

Construct from a UClass* (or something implicitly convertible to it)

◆ TSubclassOf() [6/6]

template<typename T >
template<typename OtherT >
TSubclassOf< T >::TSubclassOf ( const TSubclassOf< OtherT > &  Other)
inline

Construct from another TSubclassOf, only if types are compatible

Member Function Documentation

◆ Get()

template<typename T >
UE_FORCEINLINE_HINT UClass * TSubclassOf< T >::Get ( ) const
inline

Dereference back into a UClass*, does runtime type checking.

◆ GetDefaultObject()

template<typename T >
T * TSubclassOf< T >::GetDefaultObject ( ) const
inline

Get the CDO if we are referencing a valid class

Returns
the CDO, or null if class is null

◆ GetGCPtr()

template<typename T >
TObjectPtr< UClass > & TSubclassOf< T >::GetGCPtr ( )
inline

◆ operator UClass *()

template<typename T >
UE_FORCEINLINE_HINT TSubclassOf< T >::operator UClass * ( ) const
inline

Implicit conversion to UClass*, does runtime type checking.

◆ operator*()

template<typename T >
UClass * TSubclassOf< T >::operator* ( ) const
inline

Dereference back into a UClass*, does runtime type checking.

◆ operator->()

template<typename T >
UE_FORCEINLINE_HINT UClass * TSubclassOf< T >::operator-> ( ) const
inline

Dereference back into a UClass*, does runtime type checking.

◆ operator=() [1/5]

template<typename T >
TSubclassOf & TSubclassOf< T >::operator= ( const TSubclassOf< T > &  )
default

◆ operator=() [2/5]

template<typename T >
template<typename OtherT >
TSubclassOf & TSubclassOf< T >::operator= ( const TSubclassOf< OtherT > &  Other)
inline

Assign from another TSubclassOf, only if types are compatible

◆ operator=() [3/5]

template<typename T >
TSubclassOf & TSubclassOf< T >::operator= ( TSubclassOf< T > &&  )
default

◆ operator=() [4/5]

template<typename T >
template<typename U UE_REQUIRES>
TSubclassOf & TSubclassOf< T >::operator= ( U &&  From)
inline

Assign from a UClass* (or something implicitly convertible to it).

◆ operator=() [5/5]

template<typename T >
TSubclassOf & TSubclassOf< T >::operator= ( UClass From)
inline

Assign from a UClass*.

◆ Serialize() [1/2]

template<typename T >
UE_FORCEINLINE_HINT void TSubclassOf< T >::Serialize ( FArchive Ar)
inline

◆ Serialize() [2/2]

template<typename T >
UE_FORCEINLINE_HINT void TSubclassOf< T >::Serialize ( FStructuredArchiveSlot Slot)
inline

Friends And Related Symbol Documentation

◆ GetTypeHash

template<typename T >
uint32 GetTypeHash ( const TSubclassOf< T > &  SubclassOf)
friend

◆ TSubclassOf

template<typename T >
template<typename U >
friend class TSubclassOf
friend

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