Thanks, Roman.
On Fri, 3 Jul 2009, Fons Rademakers wrote:
> Of course you can use them! :-) I just forgot we implemented them a while
> back. That should also solve your problem, I guess, as now you know how to
> copy TClonesArrays in your copy ctor etc.
>
> Cheers, Fons.
>
>
>
> Roman Lietava wrote:
>> Thank you, Fons.
>> I am confused.
>> What are the methods I found at:
>> http://root.cern.ch/root/html/src/TClonesArray.cxx.html#gv6UBD
>> which are called TClonesArray::TClonesArray(const TClonesArray& tc):
>> TObjArray(tc)
>> {
>> // Copy ctor.
>> ...
>> }
>> TClonesArray& TClonesArray::operator=(const TClonesArray& tc)
>> {
>> // Assignment operator.
>> ...
>> }
>> ?
>> Why I cannot use them ?
>> Roman.
>>
>> On Thu, 2 Jul 2009, Fons Rademakers wrote:
>>
>>> Hi Roman,
>>>
>>> as clonesarrays are generally large objects we don't have assignment
>>> and copy ctors for them. If you really want to copy or assign objects
>>> containing TClonesArrays, you will have to loop over these arrays yourself
>>> and copy the information. If you use a pointer to a clones array you can
>>> use the TObject::Clone() method:
>>>
>>> TClonesArray *b = (TClonesArray*)a->Clone()
>>>
>>> Cheers, Fons.
>>>
>>>
>>>
>>> > Can you show me or point me to example how
>>> > to use TClonesArray in copy constructor and
>>> > in assignemnt operator, please?
>>> > Thanks,
>>> > Roman.
>>> >
>>> > E.g.:
>>> >
>>> > class item{
>>> > };
>>> >
>>> >
>>> > class myclass{
>>> > TClonesArray array; // array of item objects
>>> > } ;
>>> >
>>> > myclass::myclass(const myclass &class ){
>>> > }
>>> >
>>> > myclass& myclass::operator=(const myclass &class)
>>> > {
>>> > if(this!=&class){
>>> > }
>>> > }
>>>
>>>
>>
>
>
--Received on Fri Jul 03 2009 - 12:05:03 CEST
This archive was generated by hypermail 2.2.0 : Mon Jul 06 2009 - 05:50:03 CEST