How to use TClonesArray with template?

hi rooters,

in a template class, i want to use TClonesArray to store the template object T:

template
A::A()
{

TClonesArray *tca=new TClonesArray(“T”);

}

But it does not work. i think the problem lies in “T” but i do not know how to correct it . Can someone help?

Cheers!

Use:

TClass *cl = TClass::GetClass(typeid(T); if (cl) TClonesArray *tca=new TClonesArray(cl->GetName());Cheers,
Philippe

Hi,

[quote=“luxg”]template
A::A()
{

TClonesArray *tca=new TClonesArray(“T”);

}[/quote]
Memory allocation in the default constructor
leads to memory leaks.

Maxim Nikulin