Implicit conversion to mutable if no indirections?

Nick Treleaven nick at geany.org
Sun Sep 4 11:03:53 UTC 2022


On Friday, 2 September 2022 at 18:58:43 UTC, Ali Çehreli wrote:
> But I am aware that we can't deduce T to be 'int' because we 
> would be losing that qualifier and further template deductions 
> would be wrong. :/

Another feature that would be interesting is if an `auto` 
declaration stripped const/immutable where possible. After all, 
if the user didn't want that they could've used `const` or 
`immutable`.

```d
const i = 4; // const int
auto v = i;  // int
const a = [0]; // const(int[])
auto s = a;    // const(int)[]
```


More information about the Digitalmars-d mailing list