import std.stdio;
void main() {
    struct S {
        this(bool a) { writeln(" this"); }
        ~this() { writeln(" ~this"); }
    }

    writeln("scoped:");
    {
        auto s = S(true);
    }

    writeln("with:");
    with(S(true)) {
    }
}

Output:

scoped:
 this
 ~this
with:
 this

Reply via email to