Re: Why does this not compile?

2018-03-06 Thread Diego via Digitalmars-d
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote: void main() { struct S { uint value; ~this() { } } const S a = S(12); S b = a; } You cannot assign a const element (`a`) to a non-const element (`b`) in `S b = a` expression. To make de

Re: Is there a cleaner way of doing this?

2017-08-07 Thread Diego via Digitalmars-d
On Monday, 7 August 2017 at 08:01:26 UTC, Shachar Shemesh wrote: It is often desired to have a struct with an extra parameter. The common way to do this is like so: struct S(T) { T param; void initialize(T param) { this.param = param; // Other st