Copy Constructor DIP
Nick Treleaven
nick at geany.org
Wed Jul 11 09:55:43 UTC 2018
On Tuesday, 10 July 2018 at 10:47:04 UTC, RazvanN wrote:
> [1] https://github.com/dlang/DIPs/pull/129
Thanks for making the DIP. I can't get this code to compile (my
struct has an `int i` field):
static foreach (i, ref field; src.tupleof)
this.tupleof[i] = field;
Error: constant value src.i cannot be ref
https://run.dlang.io/is/qeugC8
Removing `static` works. Otherwise I tried changing `ref` to
`alias`:
Error: variable src cannot be read at compile time
But this shorter code seems to work fine:
this.tupleof = src.tupleof;
More information about the Digitalmars-d
mailing list