Initializing an array of TList

How can I initialize 360 of TList ? And clear memory after


perhaps the problem you are solving may have better solutions but this

auto l = new TList[360]
delete[] l;

is what you are looking for.

Hello, dplparo
thank you very much! Can you help me one more time?
How do I add elements to TList in loop?
I know that Add, but how is it right to write and display?


that is an array of TLists. You can access the elements with the operator []. Once you have in hands a pointer to a TList, you can rely on the online documentation to see how to add elements to it:


Thank you, dpiparo
So, I guess function TList::AddLast(obj);
But I misunderstanding, is it needed to include TList.h and TList.cxx library?
And how do I add in l[i] ?


you access an array with the [] operator. So you do l[3].AddLast(myObj). You do not include cxx files. You include TList.h only if you compile, you don’t if this is a macro.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.