On Sunday, 6 October 2024 at 10:53:28 UTC, Nick Treleaven wrote:
On Thursday, 3 October 2024 at 12:23:27 UTC, Holzofen wrote:
[...]
Could anybody point me to a way how to make a straight copy
without meddling with the source array?
You can copy an AA using `dup`:
https://dlang.org/phobos/object.html#.dup
Unfortunately this doesn't work:
uint64[uint64] backup = factorials[n].dup;
https://issues.dlang.org/show_bug.cgi?id=11725
Instead you can use:
auto backup = cast(uint64[uint64]) factorials[n].dup;
I think casting away const is OK because the AA produced by
`dup` is unique, and the element type doesn't have indirections.
Thanks a lot!