Michel Fortin: > and you have to worry about null. Nonnull references of course solve this problem.
> Couldn't we just make a struct that cannot be implicitly copied?
The @disable attribute was invented for this purpose too:
struct Foo {
int x;
@disable this(this) {}
}
void main() {
Foo f1;
Foo f2 = f1;
}
That prints:
test.d(7): Error: struct test9.Foo is not copyable because it is annotated with
@disable
Bye,
bearophile
