GC: memory collected but destructors not called
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 14 10:37:35 PST 2014
On 11/14/14 11:55 AM, Rainer Schuetze wrote:
>
>
> On 14.11.2014 16:44, Steven Schveighoffer wrote:
>> The issue I have is, how do you enforce that as the author of the struct?
>
> You can define "new" in the struct:
>
> struct S
> {
> new(size_t sz);
> int x;
> }
This doesn't stop array allocation, or allocation as part of a class.
-Steve
More information about the Digitalmars-d
mailing list