digitalmars.D.bugs - [Issue 12274] New: Add a finalize method for arrays
- d-bugmail puremagic.com (31/31) Feb 27 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12274
https://d.puremagic.com/issues/show_bug.cgi?id=12274 Summary: Add a finalize method for arrays Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: rswhite4 googlemail.com Since dynamic arrays don't call the DTor of their elements (thanks to the silly https://d.puremagic.com/issues/show_bug.cgi?id=12256) I suggest to add a finalize method to object.d. Something like: ---- void finalize(T)(T[] slice) { static if(is(T == struct) || is(T == class)) { foreach (ref T value; slice) { .destroy!(T)(value); } } slice = null; // or: destroy(slice); } ---- Or we extend the related destroy method with the static if. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 27 2014