On Tuesday, 15 January 2019 at 10:49:17 UTC, rikki cattermole
wrote:
Because you passed it by value to writeln, which goes on to
pass it to many other functions.
Thanks Rikki!
I was thinking about something like that.
Antonio
Hi,
In this simple example, the destructor for the struct is invoked
four more times than expected:
import std.stdio;
struct Person {
string name;
int age;
~this() {
writefln("%s is gone (0x%x)", name, );
}
}
int main(string[] args) {
Person* p = new Person;
writefln
Because you passed it by value to writeln, which goes on to pass it to
many other functions.