ngo@tammy.harvard.edu (Tom Ngo) (11/08/90)
[ Please do not reply after November 14, 1990-- I will summarize ] I have a class, A, of which multiple identical objects are typically created. I would like to save memory and time by eliminating the need for duplicate objects. An object would keep count of the number of active pointers referencing it. Calls to the destructor would decrement this count, and memory would be freed only on reaching a zero count. Unix aside: This is analogous to how the link count works in ln, rm. I am having difficulty implementing this because in C++, memory allocation and object initialization are distinct activities. Thus, new() is invoked before construction, and delete(), after destruction. This seems like it ought to be a common problem, and I would appreciate any pointers. I will keep a count of the pointers and self-destruct when the last one is gone. (Ugh.) Please e-mail to ngo@tammy.harvard.edu... -- Tom Ngo ngo@harvard.harvard.edu 617/495-1768 lab number, leave message