Immutable fields

Daniel Murphy yebblies at nospamgmail.com
Tue Nov 2 20:54:37 PDT 2010


*What the hell?

struct Foo {
    immutable int x = 3;
 this(int dummy) { auto p = &x; }
}

void main() {

 auto f = Foo(0);

 auto p = &f.x; // Will compile with this commented out
}




More information about the Digitalmars-d mailing list