AddLast() {TClonesArray}

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi. The function AddLast() creates a copy of the object in the array or, to save memory, only creates a “link”/move pointers?

TClonesArray clone("ev", 10000);
ev *x= new ev(.....);
delete x; 

Object x will still exist in the TClonesArray after the delete (as a copy) or it will be lost ?
In class reference it is described as a function that add an object to the array, but I can’t find out HOW it add the object.
Thanks a lot.

ROOT collections don’t create copies; they trade pointers (i.e. “link”, as you put it). In your example, the last element in clone will point to invalid memory, potentially causing a crash later on.

Ok. Thanks a lot Axel.