engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 友元 | 所有成员列表
TWeakPtr< ObjectType, Mode > 模板类 参考

TWeakPtr is a non-intrusive reference-counted weak object pointer. 更多...

#include <SharedPointer.h>

Public 成员函数

FORCEINLINE bool HasSameObject (const void *InOtherPtr) const
 Returns true if the object this weak pointer points to is the same as the specified object pointer.
 
FORCEINLINE const bool IsValid () const
 Checks to see if this weak pointer actually has a valid reference to an object 更多...
 
FORCEINLINE TWeakPtr & operator= (SharedPointerInternals::FNullTag *)
 Assignment to a nullptr pointer. 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & operator= (TSharedPtr< OtherType, Mode > const &InSharedPtr)
 Assignment operator sets this weak pointer from a shared pointer 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & operator= (TSharedRef< OtherType, Mode > const &InSharedRef)
 Assignment operator sets this weak pointer from a shared reference 更多...
 
FORCEINLINE TWeakPtr & operator= (TWeakPtr const &InWeakPtr)
 Assignment operator adds a weak reference to the object referenced by the specified weak pointer 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & operator= (TWeakPtr< OtherType, Mode > const &InWeakPtr)
 Assignment operator adds a weak reference to the object referenced by the specified weak pointer. 更多...
 
FORCEINLINE TSharedPtr< ObjectType, Mode > Pin () &&
 Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid. 更多...
 
FORCEINLINE TSharedPtr< ObjectType, Mode > Pin () const &
 Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid. 更多...
 
FORCEINLINE void Reset ()
 Resets this weak pointer, removing a weak reference to the object. 更多...
 
FORCEINLINE TWeakPtr (SharedPointerInternals::FNullTag *=nullptr)
 Constructs an empty TWeakPtr
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr (TSharedPtr< OtherType, Mode > const &InSharedPtr)
 Constructs a weak pointer from a shared pointer 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr (TSharedRef< OtherType, Mode > const &InSharedRef)
 Constructs a weak pointer from a shared reference 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr (TWeakPtr< OtherType, Mode > const &InWeakPtr)
 Constructs a weak pointer from a weak pointer of another type. 更多...
 

友元

uint32 GetTypeHash (const TWeakPtr< ObjectType, Mode > &InWeakPtr)
 Computes a hash code for this object 更多...
 
template<class OtherType , ESPMode OtherMode>
class TSharedPtr
 

详细描述

template<class ObjectType, ESPMode Mode>
class TWeakPtr< ObjectType, Mode >

TWeakPtr is a non-intrusive reference-counted weak object pointer.

This weak pointer will be conditionally thread-safe when the optional Mode template argument is set to ThreadSafe.

示例
/github/workspace/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

构造及析构函数说明

◆ TWeakPtr() [1/3]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr< ObjectType, Mode >::TWeakPtr ( TSharedRef< OtherType, Mode > const &  InSharedRef)
inline

Constructs a weak pointer from a shared reference

参数
InSharedRefThe shared reference to create a weak pointer from

◆ TWeakPtr() [2/3]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr< ObjectType, Mode >::TWeakPtr ( TSharedPtr< OtherType, Mode > const &  InSharedPtr)
inline

Constructs a weak pointer from a shared pointer

参数
InSharedPtrThe shared pointer to create a weak pointer from

◆ TWeakPtr() [3/3]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr< ObjectType, Mode >::TWeakPtr ( TWeakPtr< OtherType, Mode > const &  InWeakPtr)
inline

Constructs a weak pointer from a weak pointer of another type.

This constructor is intended to allow derived-to-base conversions.

参数
InWeakPtrThe weak pointer to create a weak pointer from

成员函数说明

◆ IsValid()

template<class ObjectType , ESPMode Mode>
FORCEINLINE const bool TWeakPtr< ObjectType, Mode >::IsValid ( ) const
inline

Checks to see if this weak pointer actually has a valid reference to an object

返回
True if the weak pointer is valid and a pin operator would have succeeded

◆ operator=() [1/5]

template<class ObjectType , ESPMode Mode>
FORCEINLINE TWeakPtr & TWeakPtr< ObjectType, Mode >::operator= ( SharedPointerInternals::FNullTag *  )
inline

Assignment to a nullptr pointer.

Clears this weak pointer's reference.

◆ operator=() [2/5]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & TWeakPtr< ObjectType, Mode >::operator= ( TSharedPtr< OtherType, Mode > const &  InSharedPtr)
inline

Assignment operator sets this weak pointer from a shared pointer

参数
InSharedPtrThe shared pointer used to assign to this weak pointer

◆ operator=() [3/5]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & TWeakPtr< ObjectType, Mode >::operator= ( TSharedRef< OtherType, Mode > const &  InSharedRef)
inline

Assignment operator sets this weak pointer from a shared reference

参数
InSharedRefThe shared reference used to assign to this weak pointer

◆ operator=() [4/5]

template<class ObjectType , ESPMode Mode>
FORCEINLINE TWeakPtr & TWeakPtr< ObjectType, Mode >::operator= ( TWeakPtr< ObjectType, Mode > const &  InWeakPtr)
inline

Assignment operator adds a weak reference to the object referenced by the specified weak pointer

参数
InWeakPtrThe weak pointer for the object to assign

◆ operator=() [5/5]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TWeakPtr & TWeakPtr< ObjectType, Mode >::operator= ( TWeakPtr< OtherType, Mode > const &  InWeakPtr)
inline

Assignment operator adds a weak reference to the object referenced by the specified weak pointer.

This assignment operator is intended to allow derived-to-base conversions.

参数
InWeakPtrThe weak pointer for the object to assign

◆ Pin() [1/2]

template<class ObjectType , ESPMode Mode>
FORCEINLINE TSharedPtr< ObjectType, Mode > TWeakPtr< ObjectType, Mode >::Pin ( ) &&
inline

Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid.

You should always check to make sure the returned pointer is valid before trying to dereference the shared pointer!

返回
Shared pointer for this object (will only be valid if still referenced!)

◆ Pin() [2/2]

template<class ObjectType , ESPMode Mode>
FORCEINLINE TSharedPtr< ObjectType, Mode > TWeakPtr< ObjectType, Mode >::Pin ( ) const &
inline

Converts this weak pointer to a shared pointer that you can use to access the object (if it hasn't expired yet.) Remember, if there are no more shared references to the object, the returned shared pointer will not be valid.

You should always check to make sure the returned pointer is valid before trying to dereference the shared pointer!

返回
Shared pointer for this object (will only be valid if still referenced!)

◆ Reset()

template<class ObjectType , ESPMode Mode>
FORCEINLINE void TWeakPtr< ObjectType, Mode >::Reset ( )
inline

Resets this weak pointer, removing a weak reference to the object.

If there are no other shared or weak references to the object, then the tracking object will be destroyed.

友元及相关函数文档

◆ GetTypeHash

template<class ObjectType , ESPMode Mode>
uint32 GetTypeHash ( const TWeakPtr< ObjectType, Mode > &  InWeakPtr)
friend

Computes a hash code for this object

参数
InWeakPtrWeak pointer to compute hash code for
返回
Hash code value

该类的文档由以下文件生成: