System::WeakReference<> Class Template Reference

Represents a weak reference, which references an object while still allowing that object to be deleted. More...

#include "weak_reference.h"

Inherits WeakReference< System::Object >.

Public Member Functions

 WeakReference ()
 Default constructor. More...
 
 WeakReference (std::nullptr_t)
 Constructor from nullptr. More...
 
 WeakReference (const SmartPtr< Object > &data)
 Initializes a new instance of the WeakReference class, referencing the specified object. More...
 
 WeakReference (const SmartPtr< Object > &data, bool trackResurrection)
 Initializes a new instance of the WeakReference class, referencing the specified object. More...
 
const WeakPtr< Object > & get_Target () const
 Gets the object (the target) referenced by the current WeakReference object. More...
 
void set_Target (const SmartPtr< Object > &data)
 Sets the object (the target) referenced by the current WeakReference object. More...
 
bool get_IsAlive () const
 Gets an indication whether the object referenced by the current WeakReference object has been deleted. More...
 

Detailed Description

template<>
class System::WeakReference<>

Represents a weak reference, which references an object while still allowing that object to be deleted.

Constructor & Destructor Documentation

◆ WeakReference() [1/4]

System::WeakReference<>::WeakReference ( )
inline

Default constructor.

◆ WeakReference() [2/4]

System::WeakReference<>::WeakReference ( std::nullptr_t  )
inline

Constructor from nullptr.

◆ WeakReference() [3/4]

System::WeakReference<>::WeakReference ( const SmartPtr< Object > &  data)
inline

Initializes a new instance of the WeakReference class, referencing the specified object.

Parameters
dataObject to store.

◆ WeakReference() [4/4]

System::WeakReference<>::WeakReference ( const SmartPtr< Object > &  data,
bool  trackResurrection 
)
inline

Initializes a new instance of the WeakReference class, referencing the specified object.

Parameters
dataObject to store.
trackResurrectionIgnored.

Member Function Documentation

◆ get_IsAlive()

bool System::WeakReference<>::get_IsAlive ( ) const
inline

Gets an indication whether the object referenced by the current WeakReference object has been deleted.

Returns
True if object is not expired, false otherwise.

◆ get_Target()

const WeakPtr<Object>& System::WeakReference<>::get_Target ( ) const
inline

Gets the object (the target) referenced by the current WeakReference object.

Returns
Object referenced by the current WeakReference object.

◆ set_Target()

void System::WeakReference<>::set_Target ( const SmartPtr< Object > &  data)
inline

Sets the object (the target) referenced by the current WeakReference object.

Parameters
dataObject to set.