Diligent Engine
Loading...
Searching...
No Matches
Diligent::RefCntWeakPtr< T > Class Template Reference

Implementation of weak pointer. More...

#include <RefCntAutoPtr.hpp>

Public Member Functions

bool IsValid () const noexcept
T * UnsafeRawPtr () noexcept
RefCntAutoPtr< T > Lock () const

Detailed Description

template<typename T>
class Diligent::RefCntWeakPtr< T >

Implementation of weak pointer.

Member Function Documentation

◆ IsValid()

template<typename T>
bool Diligent::RefCntWeakPtr< T >::IsValid ( ) const
inlinenoexcept
Note
This method may not be reliable in a multithreaded environment. However, when false is returned, the strong pointer created from this weak pointer will reliably be empty.

◆ Lock()

template<typename T>
RefCntAutoPtr< T > Diligent::RefCntWeakPtr< T >::Lock ( ) const
inline

Obtains a strong reference to the object.

Note
This method does not reset expired weak pointers. Call Release() explicitly to clear the weak pointer when needed.

◆ UnsafeRawPtr()

template<typename T>
T * Diligent::RefCntWeakPtr< T >::UnsafeRawPtr ( )
inlinenoexcept

Returns a raw pointer to the managed object.

Note
The object may or may not be alive. The returned pointer must not be AddRef()'d unless object lifetime is externally guaranteed. Use Lock() to atomically obtain a strong reference from this weak pointer.