Roderick Gibson: > So my question is 1) How would I declare an array of pointers to > const(Class)? That is, how do I declare an array such that the ARRAY is > mutable, but the actual objects that it points to are not (ie you could > change the pointers in the array, but you cannot change anything in a > dereferenced object).
Currently one way to do it is: import std.typecons; class Foo { int x; } void main() { Rebindable!(const(Foo))[] foos; foos.length = 5; foos[0] = new Foo(); foos[0] = new Foo(); // OK foos[0].x = 5; // Error } Bye, bearophile