[ROOT] TOrdCollection

From: Peter H. L. Christiansen (pchristi@nbi.dk)
Date: Tue Aug 14 2001 - 20:04:32 MEST


Hi

I noted that if you do AddBefore in TOrdCollection it adds the Object
twice before.

Example :
{
TOrdCollection array;
TNamed *test1 = new TNamed("test1", "test1");
TNamed *test2 = new TNamed("test2", "test2");
TNamed *test3 = new TNamed("test3", "test3");
array.Add(test1);
array.Add(test2);
cout << "Before : " << endl;
array.Print();
array.AddBefore(test2, test3);
cout << "After : " << endl;
array.Print();
}

Output :
Before :
OBJ: TNamed     test1   test1
OBJ: TNamed     test2   test2
After :
OBJ: TNamed     test3   test3
OBJ: TNamed     test1   test1
OBJ: TNamed     test2   test2

It seems that the problem is that you want to call AddAt(obj, idx) instead
of AddAt(obj, idx-1) in TOrdCollection::AddBefore().

Cheers
   Peter

Ps : root version 3.01/06 on linux RH6.2

-- 
:-) --------------------------------- )-:
|Peter H L Christiansen aka PAN @ NBI	|
|EMAIL  : pchristi@nbi.dk		|
|OFFICE : Tb1 @ NBI			|
|PHONE  : 353 25269			|
|SNAIL  : Hans Tavsensgade 35, 4th	|
|PHONE  : 35 349336			|
:-D --------------------------------- \-:



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