autodeletion of member or arrays, list... ?

From: Vincent Colin de Verdiere (Vincent.Colin.de.Verdiere@cern.ch)
Date: Thu Feb 17 2000 - 14:13:51 MET


Hi Rooters,

Currently, from what I have seen, if I have a TObjArray* A, when I delete
it, its members are not deleted unless I run A->Delete() before. The same
applies to lists. I wonder if it would be possible to add some "adoption"
mecanism which would give the responsibility of destroying objects to the
array when it is deleted.

Then for deletion, people would only need to delete the array.. It saves
one line of code ! ;-)  and it costs several lines in the array class plus
a boolean value to activate this behaviour. ;-(

But, the main point is that it would save, to my view, a lot of memory
loss mistakes: 
  when you set a new value to a bin of the array. A.At(x, i) would delete
previous object if present. It has a cost and should not be set by default
but is very usefull... I have used to it in another "somewhat" similar
system and it was very pratical !

Comments ?


A second small point on histograms !
I feel that function GetMaximum() and GetMaximumBin() are quite redundant
functions. A single one could do both !

-- Vincent

Vincent Colin de Verdiere (vincent.colin.de.verdiere@cern.ch)
at work: CERN, division EP, Office 13-1-038, CH - 1211 Geneva 23
        tel: (+41) 22 76 72839, fax: (+41) 22 767 9075
http::/www-prima.imag.fr/Prima/colin/homeGB.html



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET