Using the TObjNum class defined in the tcollex example ($ROOTSYS/test),
I am trying to iter over a list, and make the list bigger inside the
loop :
TList list ;
TObjNum* obj ;
TIter next(&list) ;
list.Add(new TObjNum(1)) ;
list.Add(new TObjNum(2)) ;
list.Add(new TObjNum(3)) ;
while ( obj = (TObjNum*)next())
{
printf("%d ",obj->GetNum()) ;
if (obj->GetNum()==3) list.Add(new TObjNum(4)) ;
}
This gives me :
1 2 3
i.e, it lacks the 4.
If I change obj->GetNum()==3 by obj->GetNum()==2 (or 1), it gives me :
1 2 3 4
i.e, correct.
Is this normal ?
Thanks.
-- APHECETCHE Laurent (mailto:aphecetche@ganil.fr) GANIL, B.P. 5027, 14076, Caen Cedex 5, France Vox: +33 (0)2 31 45 45 85 - Fax: +33 (0)2 31 45 46 65 WWW: http://ganp03.in2p3.fr/nof/ & (perso.) http://www.mygale.org/~p0mp0n