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

#include <NonNullPointer.h>

Public Types

using IntrusiveUnsetOptionalStateType = TNonNullPtr
 

Public Member Functions

UE_FORCEINLINE_HINT TNonNullPtr (EDefaultConstructNonNullPtr)
 
UE_FORCEINLINE_HINT TNonNullPtr (TYPE_OF_NULLPTR)
 
 TNonNullPtr (ObjectType *InObject)
 
template<typename OtherObjectType >
UE_FORCEINLINE_HINT TNonNullPtr (const TNonNullPtr< OtherObjectType > &Other)
 
TNonNullPtroperator= (TYPE_OF_NULLPTR)
 
TNonNullPtroperator= (ObjectType *InObject)
 
template<typename OtherObjectType >
TNonNullPtroperator= (const TNonNullPtr< OtherObjectType > &Other)
 
UE_FORCEINLINE_HINT bool operator== (const TNonNullPtr &Other) const
 
UE_FORCEINLINE_HINT bool operator!= (const TNonNullPtr &Other) const
 
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT bool operator== (OtherObjectType *Other) const
 
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT bool operator!= (OtherObjectType *Other) const
 
 operator ObjectType * () const
 
ObjectType * Get () const
 
ObjectType & operator* () const
 
ObjectType * operator-> () const
 
UE_FORCEINLINE_HINT bool IsInitialized () const
 
 operator bool () const =delete
 
UE_FORCEINLINE_HINT TNonNullPtr (FIntrusiveUnsetOptionalState)
 
UE_FORCEINLINE_HINT bool operator== (FIntrusiveUnsetOptionalState) const
 

Static Public Attributes

static constexpr bool bHasIntrusiveUnsetOptionalState = true
 

Friends

template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT friend bool operator== (OtherObjectType *Lhs, const TNonNullPtr &Rhs)
 
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT friend bool operator!= (OtherObjectType *Lhs, const TNonNullPtr &Rhs)
 
UE_FORCEINLINE_HINT uint32 GetTypeHash (const TNonNullPtr &InPtr)
 

Detailed Description

template<typename ObjectType>
class TNonNullPtr< ObjectType >

TNonNullPtr is a non-nullable, non-owning, raw/naked/unsafe pointer.

Member Typedef Documentation

◆ IntrusiveUnsetOptionalStateType

template<typename ObjectType >
using TNonNullPtr< ObjectType >::IntrusiveUnsetOptionalStateType = TNonNullPtr

Constructor & Destructor Documentation

◆ TNonNullPtr() [1/5]

template<typename ObjectType >
UE_FORCEINLINE_HINT TNonNullPtr< ObjectType >::TNonNullPtr ( EDefaultConstructNonNullPtr  )
inline

Hack that can be used under extraordinary circumstances

◆ TNonNullPtr() [2/5]

template<typename ObjectType >
UE_FORCEINLINE_HINT TNonNullPtr< ObjectType >::TNonNullPtr ( TYPE_OF_NULLPTR  )
inline

nullptr constructor - not allowed.

◆ TNonNullPtr() [3/5]

template<typename ObjectType >
TNonNullPtr< ObjectType >::TNonNullPtr ( ObjectType *  InObject)
inline

Constructs a non-null pointer from the provided pointer. Must not be nullptr.

◆ TNonNullPtr() [4/5]

template<typename ObjectType >
UE_FORCEINLINE_HINT TNonNullPtr< ObjectType >::TNonNullPtr ( const TNonNullPtr< OtherObjectType > &  Other)
inline

Constructs a non-null pointer from another non-null pointer

◆ TNonNullPtr() [5/5]

template<typename ObjectType >
UE_FORCEINLINE_HINT TNonNullPtr< ObjectType >::TNonNullPtr ( FIntrusiveUnsetOptionalState  )
inlineexplicit

Member Function Documentation

◆ Get()

template<typename ObjectType >
ObjectType * TNonNullPtr< ObjectType >::Get ( ) const
inline

Returns the internal pointer

◆ IsInitialized()

template<typename ObjectType >
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::IsInitialized ( ) const
inline

◆ operator bool()

template<typename ObjectType >
TNonNullPtr< ObjectType >::operator bool ( ) const
explicitdelete

Use IsInitialized if needed

◆ operator ObjectType *()

template<typename ObjectType >
TNonNullPtr< ObjectType >::operator ObjectType * ( ) const
inline

Returns the internal pointer

◆ operator!=() [1/2]

template<typename ObjectType >
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::operator!= ( const TNonNullPtr< ObjectType > &  Other) const
inline

◆ operator!=() [2/2]

template<typename ObjectType >
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::operator!= ( OtherObjectType Other) const
inline

◆ operator*()

template<typename ObjectType >
ObjectType & TNonNullPtr< ObjectType >::operator* ( ) const
inline

Dereference operator returns a reference to the object this pointer points to

◆ operator->()

template<typename ObjectType >
ObjectType * TNonNullPtr< ObjectType >::operator-> ( ) const
inline

Arrow operator returns a pointer to this pointer's object

◆ operator=() [1/3]

template<typename ObjectType >
TNonNullPtr & TNonNullPtr< ObjectType >::operator= ( const TNonNullPtr< OtherObjectType > &  Other)
inline

Assignment operator taking another TNonNullPtr

◆ operator=() [2/3]

template<typename ObjectType >
TNonNullPtr & TNonNullPtr< ObjectType >::operator= ( ObjectType *  InObject)
inline

Assignment operator taking a pointer

◆ operator=() [3/3]

template<typename ObjectType >
TNonNullPtr & TNonNullPtr< ObjectType >::operator= ( TYPE_OF_NULLPTR  )
inline

Assignment operator taking a nullptr - not allowed.

◆ operator==() [1/3]

template<typename ObjectType >
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::operator== ( const TNonNullPtr< ObjectType > &  Other) const
inline

Comparison, will also handle default constructed state

◆ operator==() [2/3]

template<typename ObjectType >
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::operator== ( FIntrusiveUnsetOptionalState  ) const
inline

◆ operator==() [3/3]

template<typename ObjectType >
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT bool TNonNullPtr< ObjectType >::operator== ( OtherObjectType Other) const
inline

Comparison with a raw pointer

Friends And Related Symbol Documentation

◆ GetTypeHash

template<typename ObjectType >
UE_FORCEINLINE_HINT uint32 GetTypeHash ( const TNonNullPtr< ObjectType > &  InPtr)
friend

◆ operator!=

template<typename ObjectType >
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT friend bool operator!= ( OtherObjectType Lhs,
const TNonNullPtr< ObjectType > &  Rhs 
)
friend

◆ operator==

template<typename ObjectType >
template<typename OtherObjectType UE_REQUIRES>
UE_FORCEINLINE_HINT friend bool operator== ( OtherObjectType Lhs,
const TNonNullPtr< ObjectType > &  Rhs 
)
friend

Member Data Documentation

◆ bHasIntrusiveUnsetOptionalState

template<typename ObjectType >
constexpr bool TNonNullPtr< ObjectType >::bHasIntrusiveUnsetOptionalState = true
staticconstexpr

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