dcollections 1.0 and 2.0a beta released

bearophile bearophileHUGS at lycos.com
Sat May 22 05:16:27 PDT 2010


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


More information about the Digitalmars-d-announce mailing list