-
Philippe Canal authored
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
Philippe Canal authoredalways 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