Re: initializing immutable structs

2010-03-29 Thread Paul D. Anderson
Thanks for the help. assumeUnique only works on arrays, so it wasn't a solution for me but it did point me in the right direction. I'm using a struct that contains a dynamic array as a member of another struct: - Struct S { int a; int[] b; } Struct P { int c; S s; } --

Re: initializing immutable structs

2010-03-27 Thread Simen kjaeraas
On Fri, 26 Mar 2010 06:35:29 +0100, Paul D. Anderson wrote: I want to initialize an immutable struct but I'm encountering two difficulties and I can't find the answer in the documentation. (Wouldn't it be nice if someone wrote a book?) You mean like this? http://www.amazon.com/dp/032163536

Re: initializing immutable structs

2010-03-26 Thread bearophile
Paul D. Anderson: > The primary difficulty is that I can't use a static initializer but need to > use a constructor instead. But the constructor isn't allowed as it's > non-constant expression. How do I declare the struct variable and initialize > it separately? > > The second difficulty is tha

initializing immutable structs

2010-03-25 Thread Paul D. Anderson
I want to initialize an immutable struct but I'm encountering two difficulties and I can't find the answer in the documentation. (Wouldn't it be nice if someone wrote a book?) The primary difficulty is that I can't use a static initializer but need to use a constructor instead. But the construc