class WeakReference
|
The WeakReference class can be used to savely store an object, without
disallowing that it gets destroyed. More... |
|
|
Public Methods
The WeakReference class can be used to savely store an object, without
disallowing that it gets destroyed. A typical situation where you may want
to use this is when you implement a datastructure, where A refers B, and
B refers A. Using "normal" references, this structure would never get
freed.
Usage example:
Synth_WAVE_SIN sin;
WeakReference<Synth_PLAY_WAV> weak_sin;
{
Synth_WAVE_SIN test = weak_sin;
if(test.isNull())
printf("#1 missing object\n");
else
test.start();
}
// now, the strong reference leaves
sin = Synth_WAVE_SIN::null();
{
Synth_WAVE_SIN test = weak_sin;
if(test.isNull())
printf("#2 missing object\n");
else
test.stop();
This would output "#2 missing object".
WeakReference (const WeakReference<SmartWrapper>& source)
|
WeakReference (SmartWrapper& source)
|
inline WeakReference<SmartWrapper>& operator= (const WeakReference<SmartWrapper>& source)
|
[virtual]
Reimplemented from WeakReferenceBase.
inline operator SmartWrapper ()
|
[const]
Generated by: stefan@stefan on Sat Feb 24 19:11:23 2001, using kdoc 2.0a47. |