There are two structures, one nested in the other, and the nested one is dynamic. How is the access to the fields of the nested structure (there is a pointer) and how to properly free up memory?
struct One { G4double A, B; G4int id; }; struct Two { G4int event,part; struct One *Spin=new One[part]; } TwoInc;
Twostructure is the owner of theOneinstance, it is responsible for freeing the memory. When it is “right” to free memory, the project architect should know best, that is, you. This is often done in a destructor. - VladD