cloning array
Basile.B
b2.temp at gmx.com
Wed Jun 2 17:50:12 UTC 2021
On Wednesday, 2 June 2021 at 16:50:16 UTC, Gavin Ray wrote:
> On Wednesday, 2 June 2021 at 16:07:35 UTC, Basile.B wrote:
>> works a expected. The reason why is that your array elements
>> are fat pointers, so when you dup a, you dup some fats
>> pointer, so you got the same elements as "a" but accessible
>> from another chunck of memory.
>
> Would it be worth modifying the docs for `.dup()` so that this
> behavior is clear?
>
yes, I think so, it's worth a dlang.org change.
> I would have been confused by this as well.
Me too actually. the reason why this did not work as expected was
not immediate.
> It's probably a no-brainer if you understand general memory
> principles but not everyone does.
More information about the Digitalmars-d-learn
mailing list