On 2010-05-22 08:16:27 -0400, bearophile <bearophileh...@lycos.com> said:

Michel Fortin:
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

Indeed, thanks. I figured it out by myself while you were writing this.


--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to