Re: Implicit conversion from const to mutable

2017-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/17 5:28 PM, Balagopal Komarath wrote: On Thursday, 17 August 2017 at 20:22:09 UTC, Steven Schveighoffer wrote: This should "work". I don't think your static assert will pass, but the main function below should run. Thanks. But, isn't my static assert testing for exactly this? I mi

Re: Implicit conversion from const to mutable

2017-08-17 Thread Balagopal Komarath via Digitalmars-d-learn
On Thursday, 17 August 2017 at 20:22:09 UTC, Steven Schveighoffer wrote: This should "work". I don't think your static assert will pass, but the main function below should run. Thanks. But, isn't my static assert testing for exactly this?

Re: Implicit conversion from const to mutable

2017-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/17 3:24 PM, Balagopal Komarath wrote: Is it possible to make structs containing slices support implicit conversion from const to mutable? This should "work". I don't think your static assert will pass, but the main function below should run. struct A { int[] a;

Implicit conversion from const to mutable

2017-08-17 Thread Balagopal Komarath via Digitalmars-d-learn
Is it possible to make structs containing slices support implicit conversion from const to mutable? I tried adding a postblit that dupes the member 'a'. That didn't work. struct A { int[] a; } void main() { static assert (is(const(A) : A)); // fails }