On Wednesday, 11 February 2026 at 12:41:50 UTC, Brother Bill wrote:
On Tuesday, 10 February 2026 at 20:37:04 UTC, Nick Treleaven wrote:
If you add a copy constructor to Duration, you can see when it gets copied:
```
        this(ref Duration d)
        {
                this.tupleof = d.tupleof;
                writeln("copying Duration: ", toString);
        }
```

The ```ref``` is needed to avoid yet another copy.

It's more that `ref` is part of what signifies a copy constructor:
https://dlang.org/spec/struct.html#struct-copy-constructor

Please explain what ```this.tupleof = d.tupleof;``` does in detail.

It copies the fields of `d` to the fields of `this`.

https://dlang.org/spec/class.html#tupleof

Reply via email to