RE: Removing entry from TRefArray (fwd)

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 20 Jul 2006 10:35:17 -0500


Hi,

This is the intended behavior.

Once you have removed all the item you need to remove, call array.Compress() to remove the gaps.

You can also re-use the gaps by calling AddAtFree.

Cheers,
Philippe.

Hi.

I'm a bit confused with how I should be removing objects from TRefArray. If I
do
array.RemoveAt(i); // i is definitely <= array.GetLast()

it leaves a hole, and array.GetLast() is not changed unless i == array.GeLast()
prior to removal. So, I end up doing this: if (i != array.GetLast()) array.AddAt(array.At(array.GetLast()), i); array.RemoveAt(array.GetLast());

which looks very clumsy.

I'm using ROOT 5.10/00 on Fedora Core 3.

Thanks,
Andre. Received on Thu Jul 20 2006 - 17:51:56 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET