Re: Question w.r.t. TObjArray and TClonesArray
Christoph Borgmeier (borg@ifh.de)
Thu, 16 Apr 1998 18:54:51 +0200
Dr. Nick van Eijndhoven wrote:
[...]
> - Once I have several Tracks created I want to group
> them together into a vertex.
> For this I have a class Vertex which has in its
> private area an array to store the pointers to
> the related Track objects.
>
> i.e. Track** save;
>
> and in the Vertex constructor I do :
>
> save=new Track*[n];
[...]
> Then I got the idea of using TObjArray or TClonesArray
> for this, but as far as I can see from the docs,
> these facilities can only store objects and not only
> pointers to objects.
[...]
Hello Nick,
as far as I understand the docs, you can do
TObjArray* save;
and
Track* x = ...
save->Add( x );
This works fine for me (reading and writing ROOT files).
In the roottalk digest you find some more discussion on that
(30 Mar-2 Apr). If you run into trouble with memory leaks,
I could post my the latest version of my garbage collector.
Hope that helps
Christoph