import std.stdio; struct Bar { ~this() { writeln("~bar"); } } struct Foo { Bar *bar;this(int why_the_fuck_dont_structs_have_default_constructors) {
bar = new Bar; } ~this() { writeln("~foo"); import core.memory; GC.free(bar); } }
Elronnd via Digitalmars-d-learn Wed, 27 Sep 2017 21:56:10 -0700
import std.stdio; struct Bar { ~this() { writeln("~bar"); } } struct Foo { Bar *bar;this(int why_the_fuck_dont_structs_have_default_constructors) {
bar = new Bar; } ~this() { writeln("~foo"); import core.memory; GC.free(bar); } }