immutable, const, enum
Christian Kamm
kamm-incasoftware at removethis.de
Tue Apr 28 14:17:21 PDT 2009
> immutable struct S {
> int x;
> this(int xx) { this.x = x; }
> }
As far as I know, immutable has no effect on class declarations, so what
your code says is
struct S {
immutable int x;
this(int xx) immutable { this.x = x; }
}
and that's causing problems. If you want an immutable instance, you can say:
auto c = new immutable(C)(10);
or cast an existing instance to immutable.
More information about the Digitalmars-d
mailing list