Re: how to initialise const variables

2016-02-26 Thread cym13 via Digitalmars-d-learn
On Friday, 26 February 2016 at 03:18:02 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 02:48:35 UTC, cym13 wrote: On Friday, 26 February 2016 at 02:32:44 UTC, Nicholas Wilson wrote: struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _

Re: how to initialise const variables

2016-02-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 26 February 2016 at 02:32:44 UTC, Nicholas Wilson wrote: struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _p; } } I cannot change the definition of A how do I initialise b.a.p? Use a constructor for A instead of trying to write

Re: how to initialise const variables

2016-02-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 26 February 2016 at 02:48:35 UTC, cym13 wrote: On Friday, 26 February 2016 at 02:32:44 UTC, Nicholas Wilson wrote: struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _p; } } I cannot change the definition of A how do I initialise b

Re: how to initialise const variables

2016-02-25 Thread cym13 via Digitalmars-d-learn
On Friday, 26 February 2016 at 02:32:44 UTC, Nicholas Wilson wrote: struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _p; } } I cannot change the definition of A how do I initialise b.a.p? As you did: void main() { int i = 42;

how to initialise const variables

2016-02-25 Thread Nicholas Wilson via Digitalmars-d-learn
struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _p; } } I cannot change the definition of A how do I initialise b.a.p?