Re: [ROOT] TArrayD in Classes

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Sun Nov 26 2000 - 19:09:18 MET


Hi Denis,

thanks for trying the example..
> 
> Hi Andre,
> 
> I tried your example on version 2.25.02 and i got an error message at
> event 1:
> 
> filling in 20 events
>   Event 0
>   Event 1
> Error in <TArrayD::operator[]>: index 1 out of bounds (size: 0, this:
> 0x4027c418)
> 
> I don't understand why, but eliminating the paranthesis in the line
>      (*mass_values)[i] = 0;
>   => *mass_values[i] = 0;
> it works. S.b can explain the reason please?
> 
As Steve Udriot pointed out, also simply changing the line into

   mass_values->AddAt(i,0);

(which does a call to BoundsOk() [which is a simple if statement]
before doing what operator[] does) works..


thanks,


Andre


-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET