On 03/15/2017 03:23 AM, Basile B. wrote: > you can use a mixin template because > they can introduce destructors that are called automatically with the > aggregate destrcutor > > mixin template Foo(T) > { > T x; > void foo() > { > alloc(x); > } > ~this() // auto-called by the target aggregate > { > dealloc(x); > } > } > > class bar > { > mixin Foo!Stuff; > }
Wow! Is this specified anywhere or have you come across this by chance? :) Ali