On Wednesday, 8 October 2025 at 07:46:32 UTC, Vindex9 wrote:
On Wednesday, 8 October 2025 at 02:58:15 UTC, Steven
Schveighoffer wrote:
My attempt:
```d
import std.traits;
inout(T)[] copyArray(T)(inout(T)[] arr) {
alias M = Unqual!T;
```
Unfortunately, `Unqual` in your code doesn't do anything - the
type `M` remains `T`. Apparently, some strange things are
happening inside the template when it comes to constness.
You are right, I didn't think about the fact that `T` is going to
already be unmodified (since `inout` takes over the modifier).
So really, this isn't needed, you can just use T, and rely on the
explicit conversion at the end.
Thank you, Steve.
I'm glad you were able to work it out.
-Steve