Count of object references?
bearophile
bearophileHUGS at lycos.com
Sun Aug 25 08:31:04 PDT 2013
Bottled Gin:
> Given a class object, is there a way to find out the number of
> references to it. I have a situation where a container is
> holding an object and I would like to remove the object from
> the container if there is nobody else referencing it.
>
> Is it possible in D?
What you want is a container that keeps weak references
(http://en.wikipedia.org/wiki/Weak_reference ).
Currently (I think) there are no weak references in Phobos, but
eventually it should be added. Probably somewhere there is some
implementation.
Bye,
bearophile
More information about the Digitalmars-d
mailing list