Re: Bug in TObjArray?

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Fri, 17 Sep 2010 14:50:33 +0200


Hi John,

as I said, operator[] is intentionally not const: it's used to adds elements via placement new(). I think you're looking for the member function At().

Cheers, Axel

John Idarraga wrote on 09/17/2010 02:44 PM:
> But then why Arr.GetEntries() gives 0 ? I thought the Fast version of
> GetEntries was precisely a Fast access to the number of entries, only
> safe when you have not performed any manipulation. Available for
> certain cases. I agree with Vassili that it is somewhat annoying and
> may be an error prone. But I may be misunderstanding.
>
> thanks,
>
> John
>
> Axel Naumann wrote:

>> Hi Vassili,
>>
>> yes, that's on purpose, think of
>>
>>   new (Arr[0]) TObject;
>>
>> Cheers, Axel.
>>
>>
>> Vassili Maroussov wrote on 09/17/2010 02:31 PM:
>>  
>>> Dear ROOTers,
>>>
>>> I'm wondering why TObjArray is designed in such a way that an attempt to
>>> access the [fLowerBound] element of an empty TObjArray doesn't cause any
>>> error (please see the example attached). Moreover, it has a rather
>>> unpleasant side effect: after the access GetEntriesFast() reports that
>>> the array isn't empty any more. Is it done purposely?
>>>
>>> Regards,
>>>
>>> Vassili
>>>
>>>     
>>
>>   

>
>
Received on Fri Sep 17 2010 - 14:50:38 CEST

This archive was generated by hypermail 2.2.0 : Fri Sep 17 2010 - 17:50:01 CEST