weak references

Bill Baxter wbaxter at gmail.com
Tue Aug 5 23:08:47 PDT 2008


It provides a call-back hook that can be set to get a notification
when an object you're interested in is destroyed.
And in general size_t's and other integer types are not treated as pointers.

These two things can be used to make a weak ref class, which is what
has been done here:

http://www.dsource.org/projects/scrapple/browser/trunk/weakref

On Wed, Aug 6, 2008 at 2:06 PM, PJP <pete.poulos at gmail.com> wrote:
>
> Does the D garbage collector provide something similar to the "weak" references in Java?  Weak references don't prevent the object they refer to from being garbage collected.  If the object has been garbage collected, the weak reference will return null.
>


More information about the Digitalmars-d-learn mailing list