Re: [ROOT] TObjArray size methods

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Mar 06 2001 - 19:14:15 MET


Hi Vladimir,

   TObjArray::GetSize() returns the size of the TObjArray, i.e.
the number of available slots. When doing:

TObjArray a;       // uses TCollection::kInitCapacity=16 as default size
a.GetSize();       // returns 16
TObjArray a2(1000);
a2.GetSize();      // returns 1000

GetLast() returns the last occupied slot.

Cheers, Fons.



Vladimir Nagaslaev wrote:
> 
>   Who knows what does the method TObjArray::GetSize() do?
> It always returns 16 on my platform, whatever the actual
> size of the array is. Just guessing that its meaning is
> the same as "size" in STL containers leads to bad things.
> TObjArray::GetLast() works better, but without good description
> I'm not sure it's a good thing to do.
> 
>   Vladimir.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET