BinarySearch problem

From: Tioukov Valeri (valeri@d500na1.na.infn.it)
Date: Thu Jul 01 1999 - 12:49:21 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET