Hi Fons, thanks for your macro. It works. I don't know what was wrong before, I have canceled those lines.... thanks again Andrea On Mon, 2 Dec 2002, Fons Rademakers wrote: =>Hi Andrea, => => I do not see this problem. Could you run this macro, sort.C: => =>void sort() =>{ => TObjArray a(10); => a.IsOwner(); => => for (int i = 10; i > 6; i--) => a.Add(new TObjNum(i)); => => a.Print(); => => printf("Sorted\n"); => a.Sort(); => => a.Print(); =>} => =>root [0] .x sort.C =>10 =>9 =>8 =>7 =>Sorted =>7 =>8 =>9 =>10 => =>-- Fons => => =>On Sat, 2002-11-30 at 22:11, Andrea Bocci wrote: =>> Hello folk, =>> =>> I have a stupid problem sorting an TObjArray. I followed the example in =>> =>> http://root.cern.ch/root/html/examples/tcollex.C.html =>> =>> creating a very simple array of integers, in an inverse order. =>> after the a.Print(); I have =>> =>> TObjNum = 10 =>> TObjNum = 9 =>> TObjNum = 8 =>> TObjNum = 7 =>> =>> then, after a.Sort(); printing again the TObjArray as in the web example I =>> got: =>> =>> TObjNum = 10 =>> TObjNum = 9 =>> TObjNum = 8 =>> TObjNum = 7 =>> 4 empty slot =>> 5 empty slot =>> 6 empty slot =>> 7 empty slot =>> 8 empty slot =>> 9 empty slot =>> =>> There is something that I haven't understood about this sort function.... =>> =>> Can someone please give me some help ?? =>> =>> Thanks =>> =>> =>> Andrea =>-- =>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 7679480 =>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET