Hi Pasha, I agree that it would be nice to have, however it would mean suppressing the array syntax: a[0] = obj, because allowing this one looses control about insertion/deletion since operator[] has to return a reference to a TObjArray slot. I could add this data member and invalidate it whenever operator[] is called. This would only give you benefit when using the Add(), AddAt() and Remove() methods, exclusively. Let me think about it. Cheers, Fons. > > > Hi Fons, > > wouldn't it make sense to have in TObjArray (or in one of its base collection > classes ?) one more data member - number of objects in the array? In terms of > timind efficiency this doesn't add much - just one increment/decrement per > insertion/deletion. On the other hand it is extremely useful to have number of > objects in the collection as a data member and not only as a result of > calculation. > Regards, Pasha. > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET