In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed?

// >>>>>>>>>>

import std.stdio;

struct Foo {
  Bar bar;
  ~this() {
    writeln("~Foo");
    // some code that disables call to ~Bar
  }
}

struct Bar {
  ~this() {
    writeln("~Bar");
  }
}

void main() {
  Foo foo;
}

Reply via email to