August 25, 2013 Count of object references? | ||||
---|---|---|---|---|
| ||||
Hello All 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? Regards - Puneet |
August 25, 2013 Re: Count of object references? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bottled Gin | 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 |
Copyright © 1999-2021 by the D Language Foundation