-
- Downloads
An error occurred while retrieving diff files
From ideas provided by Mike Marino, introduce TClonesArray::ConstructedAt which
always returns an already constructed object. If the slot is being used for the first time, it calls the default constructor otherwise it returns the object as is (unless a string is passed as the 2nd argument to the function in which case, it also calls Clear(second_argument) on the object). This allows replace code like: for (int i = 0; i < ev->Ntracks; i++) { new(a[i]) TTrack(x,y,z,...); ... ... } ... a.Delete(); // or a.Clear("C") with the simpler and more efficient: for (int i = 0; i < ev->Ntracks; i++) { TTrack *track = (TTrack*)a.ConstructedAt(i); track->Set(x,y,z,....); ... ... } ... a.Clear(); even in case where the TTrack class allocates memory. git-svn-id: http://root.cern.ch/svn/root/trunk@40562 27541ba8-7e3a-0410-8455-c3a389f83636
Showing
- core/cont/inc/TClonesArray.h 3 additions, 1 deletioncore/cont/inc/TClonesArray.h
- core/cont/src/TClonesArray.cxx 83 additions, 7 deletionscore/cont/src/TClonesArray.cxx
- docbook/users-guide/CollectionClasses.xml 47 additions, 46 deletionsdocbook/users-guide/CollectionClasses.xml
- docbook/users-guide/InputOutput.xml 2 additions, 1 deletiondocbook/users-guide/InputOutput.xml
- test/Event.cxx 79 additions, 8 deletionstest/Event.cxx
- test/Event.h 2 additions, 1 deletiontest/Event.h
- test/EventMT.cxx 5 additions, 4 deletionstest/EventMT.cxx
Loading
Please register or sign in to comment