Re: BinarySearch problem

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Jul 02 1999 - 13:25:26 MEST


Hi Valeri,

  I've fixed the problem. Thanks for reporting it.

Cheers, Fons.


Tioukov Valeri wrote:
> 
> Hi rooters,
> 
> The following peace of code added to tcollex.cxx gives the strange
> result:
> 
> [tyukov@chorusdq]~/R/root/test> tcollex
> TObjNum = 0
> TObjNum = 1
> TObjNum = 2
> TObjNum = 3
> TObjNum = 4
> i1= 499
> 
> -------------------------------------------------
> void Test_bc()
> {
>    TObjArray c(1000);
>    TObjNum  *e;
> 
>    for(int i=0; i<5; i++) {
>      e = new TObjNum(i);
>      c.Add(e);
>    }
> 
>    c.Sort();
>    c.Print();
> 
>    e = new TObjNum(3);
>    int i1 = c.BinarySearch(e);
> 
>    printf("i1= %d\n",i1);
> }
> --------------------------------------------------------
> 
> As you see the array c has only 5 entries, so index 499 is out
> of sence.
> What is wrong here?
> 
> I use ROOT  2.22/04  / RH6.0 /egcs-1.1.2
> 
> Regards
> Valeri

-- 
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 04 2000 - 00:43:35 MET